-
Notifications
You must be signed in to change notification settings - Fork 0
/
simulations.nb
1349 lines (1310 loc) · 68.3 KB
/
simulations.nb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(* Content-type: application/vnd.wolfram.mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Mathematica 10.0' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 158, 7]
NotebookDataLength[ 68401, 1340]
NotebookOptionsPosition[ 66839, 1285]
NotebookOutlinePosition[ 67205, 1301]
CellTagsIndexPosition[ 67162, 1298]
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{"r", "=",
RowBox[{"r0", "=", "2"}]}], ";",
RowBox[{"\[Mu]", "=",
RowBox[{"\[Mu]0", "=", "1"}]}], ";",
RowBox[{"s", "=", "0.02"}], ";",
RowBox[{"K", "=",
RowBox[{"4", " ",
RowBox[{"10", "^", "6"}]}]}], ";",
RowBox[{"U", "=",
RowBox[{"1", " ",
RowBox[{"10", "^",
RowBox[{"-", "6."}]}]}]}], ";",
RowBox[{"maxtime", "=",
RowBox[{"5", " ",
RowBox[{"10", "^", "6."}]}]}], ";",
RowBox[{"timebetweenenvchanges", "=",
RowBox[{"x", "=", "70"}]}], ";", " ",
RowBox[{"initmostfitclass", "=", "40"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"isubs", "=",
RowBox[{
RowBox[{"(",
RowBox[{"r", "-", "\[Mu]"}], ")"}], "/",
RowBox[{"(",
RowBox[{"2", "s"}], ")"}]}]}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"Print", "[",
RowBox[{"\"\<successional if << 1: \>\"", ",", " ",
RowBox[{
RowBox[{"K",
RowBox[{
RowBox[{"(",
RowBox[{"r", "-", "\[Mu]", "-",
RowBox[{"i", " ", "s"}]}], ")"}], "/", "r"}], " ",
RowBox[{"(",
RowBox[{"\[Mu]", "+",
RowBox[{"i", " ", "s"}]}], ")"}], " ", "U", " ", "i", " ",
RowBox[{"Log", "[", " ",
RowBox[{"K",
RowBox[{
RowBox[{"(",
RowBox[{"r", "-", "\[Mu]", "-",
RowBox[{"i", " ", "s"}]}], ")"}], "/", "r"}], " ", "s"}], "]"}]}],
"/.",
RowBox[{"i", "\[Rule]", " ", "isubs"}]}]}], "]"}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"Print", "[",
RowBox[{"\"\<steady state q heuristic: \>\"", ",", " ",
RowBox[{
RowBox[{"2", " ",
RowBox[{
RowBox[{"Log", "[", " ",
RowBox[{"K",
RowBox[{"(",
RowBox[{"r", "-", "\[Mu]", "-",
RowBox[{"i", " ", "s"}]}], ")"}], " ",
RowBox[{"s", "/", "r"}]}], "]"}], "/",
RowBox[{"Log", "[",
RowBox[{"s", "/",
RowBox[{"(",
RowBox[{"U", " ", "i"}], ")"}]}], "]"}]}]}], "/.",
RowBox[{"i", "\[Rule]", " ", "isubs"}]}]}], "]"}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"Print", "[",
RowBox[{
"\"\<extinction threshold: \!\(\*SubscriptBox[\(i\), \(ext\)]\)=\>\"", ",",
" ",
RowBox[{"Ceiling", "[",
RowBox[{
RowBox[{"(",
RowBox[{"r", "-", "\[Mu]"}], ")"}], "/", "s"}], "]"}]}], "]"}],
";"}], "\[IndentingNewLine]",
RowBox[{"Print", "[",
RowBox[{"\"\<Typical successional adaptation timescale: \>\"", ",", " ",
RowBox[{
RowBox[{"1", "/",
RowBox[{"(", " ",
RowBox[{
RowBox[{"K", "/", "r"}],
RowBox[{"(",
RowBox[{"r", "-", "\[Mu]", "-",
RowBox[{"i", " ", "s"}]}], ")"}], "U", " ", "i", " ", "s"}], ")"}]}],
" ", "/.",
RowBox[{"i", "\[Rule]", " ", "isubs"}]}]}], "]"}], "\[IndentingNewLine]",
RowBox[{"Print", "[",
RowBox[{"\"\<Typical MM adaptation timescale: \>\"", ",", " ",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"2",
RowBox[{"Log", "[", " ",
RowBox[{
RowBox[{"K", "/", "r"}],
RowBox[{"(",
RowBox[{"r", "-",
RowBox[{"i", " ", "s"}], "-", "\[Mu]"}], ")"}], " ", "s"}],
"]"}]}], "-",
RowBox[{"Log", "[",
RowBox[{"s", "/",
RowBox[{"(",
RowBox[{"U", " ", "i"}], ")"}]}], "]"}]}], ")"}],
RowBox[{"s", "/",
RowBox[{
RowBox[{"(",
RowBox[{"Log", "[",
RowBox[{"s", "/",
RowBox[{"(",
RowBox[{"U", " ", "i"}], ")"}]}], "]"}], ")"}], "^", "2"}]}]}],
")"}], "^",
RowBox[{"-", "1"}]}], " ", "/.",
RowBox[{"i", "\[Rule]", " ", "isubs"}]}]}], "]"}], "\[IndentingNewLine]",
RowBox[{"Print", "[",
RowBox[{"\"\<Typical pop. size: \>\"", ",", " ",
RowBox[{
RowBox[{
RowBox[{"K", "/", "r"}],
RowBox[{"(",
RowBox[{"r", "-", "\[Mu]", "-",
RowBox[{"i", " ", "s"}]}], ")"}]}], "/.",
RowBox[{"i", "\[Rule]", " ", "isubs"}]}]}], "]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"verbose", "=", "False"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"veryverbose", "=", "False"}], ";"}]}], "Input",
CellChangeTimes->{{3.6434863181562214`*^9, 3.6434863744854436`*^9}, {
3.6434864875369096`*^9, 3.643486508256095*^9}, 3.6434866091938677`*^9, {
3.6434873323862324`*^9, 3.6434873453499737`*^9}, {3.643487405151394*^9,
3.6434874087135983`*^9}, {3.643487452087079*^9, 3.6434874541541967`*^9}, {
3.643487490454273*^9, 3.6434874988097515`*^9}, {3.6435067238158503`*^9,
3.6435067313362803`*^9}, {3.6435462146351876`*^9, 3.643546251973323*^9}, {
3.643546294039729*^9, 3.6435462954668107`*^9}, {3.643546369299034*^9,
3.6435463694180403`*^9}, {3.6435464411051407`*^9,
3.6435464411931458`*^9}, {3.643546491163004*^9, 3.6435465076839485`*^9}, {
3.643546540837845*^9, 3.6435465741277494`*^9}, {3.6435466621787853`*^9,
3.6435466651209536`*^9}, {3.6435466951876736`*^9,
3.6435466981968455`*^9}, {3.643548519476017*^9, 3.6435485195440207`*^9}, {
3.643587186683941*^9, 3.6435871961114807`*^9}, 3.6435872603111525`*^9, {
3.643587814303839*^9, 3.6435878925833163`*^9}, {3.6435899500759983`*^9,
3.6435899514420767`*^9}, {3.6435952047345476`*^9, 3.643595265092*^9}, {
3.643595697387726*^9, 3.6435956975007324`*^9}, {3.6435957474965916`*^9,
3.6435957782773523`*^9}, {3.643595837998768*^9, 3.643595876781986*^9}, {
3.6436272582935085`*^9, 3.643627258349512*^9}, {3.6436327865881376`*^9,
3.643632788131226*^9}, {3.6436350728329034`*^9, 3.6436350821344357`*^9}, {
3.643635175832795*^9, 3.643635224307567*^9}, 3.6436354909338174`*^9, {
3.6438385422842517`*^9, 3.6438386088940616`*^9}, {3.643901309466378*^9,
3.643901335358859*^9}, {3.6439014275191298`*^9, 3.6439014289212103`*^9}, {
3.6439445725379295`*^9, 3.643944572647936*^9}, {3.6439747737670918`*^9,
3.643974776060223*^9}, {3.643974838757809*^9, 3.6439748955530577`*^9}, {
3.643974966069091*^9, 3.6439749992989917`*^9}, {3.6439751313835464`*^9,
3.643975151133676*^9}, {3.644076893119807*^9, 3.6440769058605356`*^9}, {
3.644090683769865*^9, 3.6440906840728827`*^9}, {3.6440918822584147`*^9,
3.644091882362421*^9}, {3.6440926928777795`*^9, 3.644092693428811*^9}, {
3.644121724512901*^9, 3.6441217666753125`*^9}, {3.644121829529907*^9,
3.644121829949931*^9}, 3.6441224826982665`*^9, {3.6441429273260603`*^9,
3.6441429274030647`*^9}, {3.64414398140035*^9, 3.6441439815143566`*^9}, {
3.644144167043968*^9, 3.6441441678210125`*^9}, {3.644144642399157*^9,
3.6441446424411592`*^9}, {3.6441460177955613`*^9, 3.644146026671069*^9}, {
3.6441480360910015`*^9, 3.644148085621834*^9}, {3.6441483063344584`*^9,
3.644148326901634*^9}, {3.644148437285948*^9, 3.6441484373799534`*^9}, {
3.6441486180792885`*^9, 3.6441486256617227`*^9}, {3.6441509545139256`*^9,
3.6441509612473106`*^9}, {3.644151020251685*^9, 3.644151072151654*^9}, {
3.6441515284947553`*^9, 3.6441515288267736`*^9}, {3.644158593769992*^9,
3.644158593838996*^9}, {3.6441586292040186`*^9, 3.644158629279023*^9}, {
3.644162184308359*^9, 3.6441622207504435`*^9}, {3.644243027498145*^9,
3.64424306096906*^9}, {3.6442470540344496`*^9, 3.6442470723904996`*^9}, {
3.6442471133268414`*^9, 3.6442471696320615`*^9}, {3.6442529258508525`*^9,
3.6442529511372986`*^9}, {3.644782255135223*^9, 3.6447822599845004`*^9}, {
3.644782777051075*^9, 3.6447827772310853`*^9}, {3.6448012881308146`*^9,
3.6448012882138195`*^9}, {3.6448032946645823`*^9, 3.644803300151896*^9}, {
3.6448064745854635`*^9, 3.6448064746904693`*^9}, {3.6448066108522573`*^9,
3.644806634836629*^9}, {3.644843738351387*^9, 3.644843748179949*^9}, {
3.644847187101644*^9, 3.644847197678249*^9}, {3.6448476267327895`*^9,
3.644847630448002*^9}, 3.644847678124729*^9, 3.644847724389375*^9, {
3.644897049651187*^9, 3.6448970798849163`*^9}, {3.644897219231887*^9,
3.644897219533904*^9}, {3.644897284362612*^9, 3.644897304297752*^9}, {
3.6448975763313117`*^9, 3.644897583156702*^9}, {3.644897623476008*^9,
3.6448976731938515`*^9}, {3.644897759823807*^9, 3.6448977660861645`*^9}, {
3.6448978091306267`*^9, 3.6448978650228233`*^9}, {3.644898161937806*^9,
3.6448981869282355`*^9}, {3.6448987587279406`*^9,
3.6448987813042316`*^9}, {3.6448988625418787`*^9,
3.6448988626418843`*^9}, {3.6453217548319654`*^9,
3.6453217624123993`*^9}, {3.6453218234898925`*^9, 3.6453218281361585`*^9},
3.645376718534374*^9, 3.6453775132948313`*^9, {3.6453775701820855`*^9,
3.64537757026009*^9}, {3.6453776018108945`*^9, 3.645377612587511*^9}, {
3.6584939232050047`*^9, 3.658493925082733*^9}, 3.658493995610083*^9, {
3.6584966269111853`*^9, 3.658496626978294*^9}, {3.65849682970822*^9,
3.658496853097897*^9}, {3.658497126255994*^9, 3.658497126334976*^9}, {
3.6584972470146837`*^9, 3.65849725781594*^9}, {3.658498065767951*^9,
3.6584980969985228`*^9}, {3.658498223148493*^9, 3.658498230263566*^9}, {
3.658498535050528*^9, 3.65849857806567*^9}, {3.65849891920791*^9,
3.658498936600153*^9}, {3.6584989835345182`*^9, 3.658498983632407*^9}, {
3.658499089496396*^9, 3.658499094705144*^9}, {3.658499198002385*^9,
3.658499198261726*^9}, {3.6584992743782253`*^9, 3.658499287947082*^9}, {
3.658499318802478*^9, 3.658499318868922*^9}, {3.658499400751025*^9,
3.658499401148713*^9}, {3.658671601991529*^9, 3.658671606253516*^9}, {
3.658672105573435*^9, 3.6586721056282873`*^9}, {3.6586806290075283`*^9,
3.658680644686989*^9}, {3.658680896932002*^9, 3.658680918599057*^9}, {
3.658680998155891*^9, 3.658681000247913*^9}, {3.6586811460833263`*^9,
3.658681169900003*^9}, {3.658681238006118*^9, 3.6586812482529383`*^9}, {
3.658683289281913*^9, 3.658683381279245*^9}, {3.658690109767433*^9,
3.658690138447916*^9}, {3.6586910886670837`*^9, 3.658691194758298*^9}, {
3.658691269096842*^9, 3.658691328043695*^9}, {3.658695759166306*^9,
3.658695761516964*^9}, {3.658753342302249*^9, 3.6587534037667*^9},
3.65875347224507*^9, {3.6587538252494907`*^9, 3.658753858714882*^9}, {
3.658754929727335*^9, 3.658754929774705*^9}, {3.658758207522624*^9,
3.6587582573314257`*^9}, {3.65875932970954*^9, 3.658759344007246*^9}, {
3.658760281527294*^9, 3.658760284413739*^9}, {3.659097814032024*^9,
3.659097880729252*^9}, 3.6591873745556583`*^9, {3.659187553831306*^9,
3.659187574508482*^9}, 3.659207062045*^9, {3.6592075384619303`*^9,
3.6592075387187223`*^9}, {3.659209357848762*^9, 3.659209392382756*^9}, {
3.659211119749789*^9, 3.659211121368264*^9}, {3.659211152018066*^9,
3.659211153545257*^9}, {3.6621337647809277`*^9, 3.662133776607604*^9}, {
3.662211461799049*^9, 3.662211461862402*^9}, {3.664140257943962*^9,
3.66414026115073*^9}, {3.664140300314168*^9, 3.6641403009043827`*^9}, {
3.664140356425082*^9, 3.664140386743166*^9}, {3.664140493081398*^9,
3.6641404933675823`*^9}, {3.674302018722415*^9, 3.6743020188098097`*^9}, {
3.6743021212313004`*^9, 3.674302121331211*^9}, {3.674302434932486*^9,
3.6743024369359217`*^9}, {3.674303183230567*^9, 3.6743031990828133`*^9}, {
3.674390217005991*^9, 3.674390226528685*^9}, {3.677735838696845*^9,
3.677735838929064*^9}}],
Cell[CellGroupData[{
Cell[BoxData[
InterpretationBox[
RowBox[{"\<\"successional if << 1: \"\>", "\[InvisibleSpace]",
"371.3807832201048`"}],
SequenceForm["successional if << 1: ", 371.3807832201048],
Editable->False]], "Print",
CellChangeTimes->{
3.6610449941641207`*^9, 3.662086323654051*^9, 3.662133674147743*^9, {
3.6621337654639664`*^9, 3.6621337773466463`*^9}, {3.6622114588532467`*^9,
3.6622114621513*^9}, 3.662407060609943*^9, 3.6632848021695175`*^9,
3.6633339883743963`*^9, 3.663591415965019*^9, 3.663694414004311*^9,
3.664110718278327*^9, 3.6641402452378674`*^9, 3.6641404971824102`*^9,
3.664541696947221*^9, 3.664563691584939*^9, 3.6742274313411083`*^9,
3.6742475733305902`*^9, 3.674301179266737*^9, 3.674302019325753*^9,
3.674302121684814*^9, 3.674302582252178*^9, {3.6743031954464693`*^9,
3.674303199431863*^9}, {3.67439021784414*^9, 3.67439022708202*^9},
3.677729297269388*^9, 3.677868860211582*^9, 3.678037296372024*^9,
3.6781257231238194`*^9, 3.678198299487165*^9}],
Cell[BoxData[
InterpretationBox[
RowBox[{"\<\"steady state q heuristic: \"\>", "\[InvisibleSpace]",
"2.963070393915362`"}],
SequenceForm["steady state q heuristic: ", 2.963070393915362],
Editable->False]], "Print",
CellChangeTimes->{
3.6610449941641207`*^9, 3.662086323654051*^9, 3.662133674147743*^9, {
3.6621337654639664`*^9, 3.6621337773466463`*^9}, {3.6622114588532467`*^9,
3.6622114621513*^9}, 3.662407060609943*^9, 3.6632848021695175`*^9,
3.6633339883743963`*^9, 3.663591415965019*^9, 3.663694414004311*^9,
3.664110718278327*^9, 3.6641402452378674`*^9, 3.6641404971824102`*^9,
3.664541696947221*^9, 3.664563691584939*^9, 3.6742274313411083`*^9,
3.6742475733305902`*^9, 3.674301179266737*^9, 3.674302019325753*^9,
3.674302121684814*^9, 3.674302582252178*^9, {3.6743031954464693`*^9,
3.674303199431863*^9}, {3.67439021784414*^9, 3.67439022708202*^9},
3.677729297269388*^9, 3.677868860211582*^9, 3.678037296372024*^9,
3.6781257231238194`*^9, 3.678198299488882*^9}],
Cell[BoxData[
InterpretationBox[
RowBox[{"\<\"extinction threshold: \\!\\(\\*SubscriptBox[\\(i\\), \
\\(ext\\)]\\)=\"\>", "\[InvisibleSpace]", "50"}],
SequenceForm[
"extinction threshold: \!\(\*SubscriptBox[\(i\), \(ext\)]\)=", 50],
Editable->False]], "Print",
CellChangeTimes->{
3.6610449941641207`*^9, 3.662086323654051*^9, 3.662133674147743*^9, {
3.6621337654639664`*^9, 3.6621337773466463`*^9}, {3.6622114588532467`*^9,
3.6622114621513*^9}, 3.662407060609943*^9, 3.6632848021695175`*^9,
3.6633339883743963`*^9, 3.663591415965019*^9, 3.663694414004311*^9,
3.664110718278327*^9, 3.6641402452378674`*^9, 3.6641404971824102`*^9,
3.664541696947221*^9, 3.664563691584939*^9, 3.6742274313411083`*^9,
3.6742475733305902`*^9, 3.674301179266737*^9, 3.674302019325753*^9,
3.674302121684814*^9, 3.674302582252178*^9, {3.6743031954464693`*^9,
3.674303199431863*^9}, {3.67439021784414*^9, 3.67439022708202*^9},
3.677729297269388*^9, 3.677868860211582*^9, 3.678037296372024*^9,
3.6781257231238194`*^9, 3.678198299489339*^9}],
Cell[BoxData[
InterpretationBox[
RowBox[{"\<\"Typical successional adaptation timescale: \"\>",
"\[InvisibleSpace]", "2.`"}],
SequenceForm["Typical successional adaptation timescale: ", 2.],
Editable->False]], "Print",
CellChangeTimes->{
3.6610449941641207`*^9, 3.662086323654051*^9, 3.662133674147743*^9, {
3.6621337654639664`*^9, 3.6621337773466463`*^9}, {3.6622114588532467`*^9,
3.6622114621513*^9}, 3.662407060609943*^9, 3.6632848021695175`*^9,
3.6633339883743963`*^9, 3.663591415965019*^9, 3.663694414004311*^9,
3.664110718278327*^9, 3.6641402452378674`*^9, 3.6641404971824102`*^9,
3.664541696947221*^9, 3.664563691584939*^9, 3.6742274313411083`*^9,
3.6742475733305902`*^9, 3.674301179266737*^9, 3.674302019325753*^9,
3.674302121684814*^9, 3.674302582252178*^9, {3.6743031954464693`*^9,
3.674303199431863*^9}, {3.67439021784414*^9, 3.67439022708202*^9},
3.677729297269388*^9, 3.677868860211582*^9, 3.678037296372024*^9,
3.6781257231238194`*^9, 3.678198299489703*^9}],
Cell[BoxData[
InterpretationBox[
RowBox[{"\<\"Typical MM adaptation timescale: \"\>", "\[InvisibleSpace]",
"170.2590938253469`"}],
SequenceForm["Typical MM adaptation timescale: ", 170.2590938253469],
Editable->False]], "Print",
CellChangeTimes->{
3.6610449941641207`*^9, 3.662086323654051*^9, 3.662133674147743*^9, {
3.6621337654639664`*^9, 3.6621337773466463`*^9}, {3.6622114588532467`*^9,
3.6622114621513*^9}, 3.662407060609943*^9, 3.6632848021695175`*^9,
3.6633339883743963`*^9, 3.663591415965019*^9, 3.663694414004311*^9,
3.664110718278327*^9, 3.6641402452378674`*^9, 3.6641404971824102`*^9,
3.664541696947221*^9, 3.664563691584939*^9, 3.6742274313411083`*^9,
3.6742475733305902`*^9, 3.674301179266737*^9, 3.674302019325753*^9,
3.674302121684814*^9, 3.674302582252178*^9, {3.6743031954464693`*^9,
3.674303199431863*^9}, {3.67439021784414*^9, 3.67439022708202*^9},
3.677729297269388*^9, 3.677868860211582*^9, 3.678037296372024*^9,
3.6781257231238194`*^9, 3.678198299490061*^9}],
Cell[BoxData[
InterpretationBox[
RowBox[{"\<\"Typical pop. size: \"\>", "\[InvisibleSpace]", "1.`*^6"}],
SequenceForm["Typical pop. size: ", 1.*^6],
Editable->False]], "Print",
CellChangeTimes->{
3.6610449941641207`*^9, 3.662086323654051*^9, 3.662133674147743*^9, {
3.6621337654639664`*^9, 3.6621337773466463`*^9}, {3.6622114588532467`*^9,
3.6622114621513*^9}, 3.662407060609943*^9, 3.6632848021695175`*^9,
3.6633339883743963`*^9, 3.663591415965019*^9, 3.663694414004311*^9,
3.664110718278327*^9, 3.6641402452378674`*^9, 3.6641404971824102`*^9,
3.664541696947221*^9, 3.664563691584939*^9, 3.6742274313411083`*^9,
3.6742475733305902`*^9, 3.674301179266737*^9, 3.674302019325753*^9,
3.674302121684814*^9, 3.674302582252178*^9, {3.6743031954464693`*^9,
3.674303199431863*^9}, {3.67439021784414*^9, 3.67439022708202*^9},
3.677729297269388*^9, 3.677868860211582*^9, 3.678037296372024*^9,
3.6781257231238194`*^9, 3.678198299490427*^9}]
}, Open ]]
}, Open ]],
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{
RowBox[{"(*",
RowBox[{"Single", " ", "runs"}], "*)"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"out", "=",
RowBox[{"RunSimulationCheckEachMutation2", "[",
RowBox[{"r", ",", "\[Mu]", ",", "s", ",", "K", ",", "U", ",",
RowBox[{"1", " ",
RowBox[{"10", "^", "5"}]}], ",", "150", ",", "20"}], "]"}]}],
";"}]}]], "Input",
CellChangeTimes->{{3.6343116199685893`*^9, 3.63431166072692*^9}, {
3.634311701699264*^9, 3.634311760806645*^9}, {3.634311801315962*^9,
3.634311813780675*^9}, {3.63432100808436*^9, 3.634321039814175*^9}, {
3.6343216508681254`*^9, 3.63432165129615*^9}, {3.6343221279044104`*^9,
3.6343221282924323`*^9}, 3.634323571600985*^9, {3.6344071518268576`*^9,
3.6344071597183094`*^9}, {3.6344084825969734`*^9,
3.6344084826719775`*^9}, {3.6344085717150707`*^9,
3.6344085730021443`*^9}, {3.6344087341993647`*^9,
3.6344087388686314`*^9}, {3.6344088903462954`*^9,
3.6344088927114305`*^9}, {3.6344932277491655`*^9, 3.634493229337256*^9}, {
3.6344934450405936`*^9, 3.634493490213177*^9}, {3.6344936928297663`*^9,
3.6344936929267716`*^9}, 3.634493735993235*^9, {3.6344939864955626`*^9,
3.634494013387101*^9}, {3.6344943007785387`*^9, 3.634494303331685*^9}, {
3.634494346975181*^9, 3.6344943791280203`*^9}, {3.6344945868589015`*^9,
3.6344945975035105`*^9}, {3.6345009131647453`*^9,
3.6345009135787697`*^9}, {3.634501005845047*^9, 3.634501009430252*^9}, {
3.634501616446971*^9, 3.6345016165199757`*^9}, {3.63484740670529*^9,
3.6348474067252903`*^9}, {3.6348561168624277`*^9, 3.634856135927518*^9}, {
3.634856171016525*^9, 3.6348561727546244`*^9}, {3.634920054662875*^9,
3.6349200756200743`*^9}, 3.6349204619411707`*^9, {3.6349206638127165`*^9,
3.634920663902722*^9}, {3.6349207199319267`*^9, 3.6349207583961267`*^9}, {
3.634920800554538*^9, 3.63492084202691*^9}, {3.6349208958139863`*^9,
3.6349209673860803`*^9}, {3.6349446586861467`*^9, 3.634944670487822*^9}, {
3.634944737646663*^9, 3.634944737813673*^9}, {3.635009962580408*^9,
3.6350099626744137`*^9}, {3.635071190199461*^9, 3.6350711909485035`*^9}, {
3.6351047626943183`*^9, 3.6351047628643284`*^9}, {3.635105202968501*^9,
3.6351052030645065`*^9}, {3.635105239447587*^9, 3.6351052395415926`*^9}, {
3.6351053393202996`*^9, 3.6351053393883038`*^9}, {3.635105383405821*^9,
3.6351053834838257`*^9}, {3.635107152214991*^9, 3.635107152425003*^9}, {
3.635132327299666*^9, 3.6351323273896713`*^9}, {3.635132384043912*^9,
3.6351323841119156`*^9}, 3.635132486744786*^9, {3.6351325187516165`*^9,
3.635132518845622*^9}, {3.635178744578456*^9, 3.6351787450004797`*^9}, {
3.635178925133783*^9, 3.6351789251827855`*^9}, {3.635178962931945*^9,
3.6351789630259504`*^9}, 3.6351932889023438`*^9, {3.635341365441581*^9,
3.635341365827603*^9}, 3.635430216287228*^9, 3.6354620301542587`*^9, {
3.635462120010398*^9, 3.635462122277528*^9}, {3.6354624672672596`*^9,
3.635462467356265*^9}, 3.635462823780651*^9, {3.635462860024724*^9,
3.6354628600997286`*^9}, {3.635463402327742*^9, 3.635463402393746*^9},
3.6354662148186073`*^9, 3.6354665617774525`*^9, {3.6354671168071985`*^9,
3.6354671168872027`*^9}, {3.6355277169855185`*^9,
3.6355277306463003`*^9}, {3.635527908940498*^9, 3.6355279355030174`*^9}, {
3.6355279735001907`*^9, 3.635527991354212*^9}, {3.635528106936823*^9,
3.6355281072118387`*^9}, {3.636980644237239*^9, 3.6369806443712463`*^9}, {
3.6421672809927034`*^9, 3.6421672813087215`*^9}, {3.6421675964747477`*^9,
3.642167601316025*^9}, {3.6422543110770507`*^9, 3.6422543111660557`*^9}, {
3.643396553622627*^9, 3.6433965558097515`*^9}, {3.64339660665666*^9,
3.6433966068006687`*^9}, 3.6433967390802345`*^9, {3.643396875868058*^9,
3.6433968759470625`*^9}, {3.6433970957686357`*^9, 3.643397118290924*^9}, {
3.6433971647855835`*^9, 3.6433971675067387`*^9}, {3.6433974768834343`*^9,
3.6433974859979553`*^9}, {3.6434020255036*^9, 3.643402191603101*^9}, {
3.643461113730156*^9, 3.643461116491314*^9}, {3.6434611544034824`*^9,
3.643461156216586*^9}, {3.6434630532090874`*^9, 3.6434630719681606`*^9}, {
3.643463890429974*^9, 3.64346389053798*^9}, {3.6434640005862746`*^9,
3.643464012775972*^9}, {3.643464119673086*^9, 3.643464140798294*^9}, {
3.643464171964077*^9, 3.64346418180964*^9}, {3.64346450070288*^9,
3.643464505197137*^9}, 3.6434645608113174`*^9, {3.643464596499359*^9,
3.6434645966783695`*^9}, {3.643465227231435*^9, 3.643465227310439*^9}, {
3.643486279575015*^9, 3.643486294221853*^9}, {3.6434863930355043`*^9,
3.643486400356923*^9}, 3.643506744581038*^9, {3.643541668906187*^9,
3.643541692643544*^9}, {3.6435418253491344`*^9, 3.6435418255511465`*^9}, {
3.64354191164007*^9, 3.6435419124321156`*^9}, {3.64354256096721*^9,
3.643542561056215*^9}, {3.6435426581177664`*^9, 3.64354265835778*^9}, {
3.6435872692596645`*^9, 3.643587269343669*^9}, {3.6435882619724445`*^9,
3.643588262454472*^9}, {3.643588998499571*^9, 3.6435890061250076`*^9},
3.6435899413024964`*^9, {3.643590507272868*^9, 3.6435905073448725`*^9}, {
3.6435947340196247`*^9, 3.643594735304698*^9}, {3.643627607780498*^9,
3.6436276175060544`*^9}, {3.643628747723699*^9, 3.643628747923711*^9}, {
3.6436353478936357`*^9, 3.643635354361006*^9}, 3.643635527430905*^9, {
3.644142795389514*^9, 3.644142795477519*^9}, {3.644142941266858*^9,
3.644142941361863*^9}, {3.644143544553364*^9, 3.6441435643004932`*^9}, {
3.6441438694409466`*^9, 3.6441438758263116`*^9}, {3.6441442052971563`*^9,
3.64414422511629*^9}, {3.6441460687664766`*^9, 3.6441460830042906`*^9}, {
3.644146337479846*^9, 3.6441463375288486`*^9}, {3.6441465632337584`*^9,
3.644146563463772*^9}, {3.6441481192657585`*^9, 3.6441481195357738`*^9}, {
3.644148165497403*^9, 3.6441481688485947`*^9}, {3.6441511093527813`*^9,
3.6441511428947*^9}, {3.644158075930373*^9, 3.644158079222562*^9}, {
3.644158134857744*^9, 3.6441581360358114`*^9}, {3.6441585723067646`*^9,
3.644158574059865*^9}, {3.644158688690421*^9, 3.6441587114057207`*^9}, {
3.644162202312389*^9, 3.6441622024113946`*^9}, {3.644162250704157*^9,
3.6441622545683775`*^9}, 3.6441627139246516`*^9, {3.644162866196361*^9,
3.6441628663853717`*^9}, {3.644163022319291*^9, 3.6441630242253995`*^9}, {
3.6448438171228924`*^9, 3.6448438233122463`*^9}, {3.6448440146401896`*^9,
3.6448440153622313`*^9}, {3.6448445830847025`*^9,
3.6448445831987095`*^9}, {3.644894005328062*^9, 3.6448940061811104`*^9}, {
3.644894158906846*^9, 3.64489415897885*^9}, {3.6453601412402067`*^9,
3.645360168869787*^9}, {3.6453603403975983`*^9, 3.645360340453601*^9}, {
3.658494010100418*^9, 3.658494010693296*^9}, {3.659377833873289*^9,
3.659377849377163*^9}, {3.65937789132275*^9, 3.659377891594263*^9}, {
3.65937792865077*^9, 3.6593779287305326`*^9}, {3.659379040352598*^9,
3.6593790404352283`*^9}, {3.659385867067572*^9, 3.659385867146583*^9}, {
3.659388599910955*^9, 3.65938860201607*^9}, {3.6593897014972687`*^9,
3.659389706909789*^9}, {3.6610454951387744`*^9, 3.66104549523778*^9}, {
3.661048693694721*^9, 3.6610486937527246`*^9}, {3.6610492830504303`*^9,
3.661049283134435*^9}, {3.6610529356868486`*^9, 3.6610529363838882`*^9}, {
3.661053010755142*^9, 3.6610530111661654`*^9}, {3.664140513932455*^9,
3.6641405157611217`*^9}, {3.6641407119201813`*^9, 3.664140712003524*^9}, {
3.6641409431038647`*^9, 3.664140946900598*^9}, {3.664141928059988*^9,
3.664141930226511*^9}, {3.664200836665553*^9, 3.664200839499455*^9}, {
3.6642181993908*^9, 3.6642182072784758`*^9}, 3.664225330951334*^9, {
3.664225367789798*^9, 3.664225370206087*^9}, {3.664225479047591*^9,
3.6642254799588947`*^9}, {3.664225960934021*^9, 3.664225970413776*^9}, {
3.66422842218141*^9, 3.664228422288046*^9}, {3.6777293344219923`*^9,
3.6777293344325047`*^9}, {3.677729655353284*^9, 3.677729655536977*^9}, {
3.6777342629385347`*^9, 3.677734263056183*^9}, {3.677735398769992*^9,
3.677735398831092*^9}, {3.6777356242772617`*^9, 3.67773562723055*^9}, {
3.6777358372165213`*^9, 3.677735841264436*^9}, {3.677802362891919*^9,
3.677802381346877*^9}, {3.677802848946415*^9, 3.677802849018196*^9}, {
3.677803196255906*^9, 3.677803196311692*^9}, {3.6781257357077217`*^9,
3.6781257357632713`*^9}, {3.678135835639452*^9, 3.678135843942728*^9}}],
Cell[BoxData[
InterpretationBox[
RowBox[{"\<\"going extinct at time \"\>", "\[InvisibleSpace]",
"45438.408511577065`", "\[InvisibleSpace]", "\<\" before time \"\>",
"\[InvisibleSpace]", "45517.27375730434`",
"\[InvisibleSpace]", "\<\" and \"\>", "\[InvisibleSpace]", "303",
"\[InvisibleSpace]", "\<\" changes at rate \"\>", "\[InvisibleSpace]",
"150"}],
SequenceForm[
"going extinct at time ", 45438.408511577065`, " before time ",
45517.27375730434, " and ", 303, " changes at rate ", 150],
Editable->False]], "Print",
CellChangeTimes->{3.6778028999565163`*^9, 3.677803035521222*^9,
3.6778032554624987`*^9, 3.67780338320855*^9, 3.6778034700844927`*^9,
3.6778035474822397`*^9, 3.6781261052671547`*^9}]
}, Open ]],
Cell[BoxData[
RowBox[{
RowBox[{"(*",
RowBox[{
RowBox[{"Scans", " ", "over", " ", "T"}], ",", " ", "parallelized"}],
"*)"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"With", "[",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"r", "=", "2"}], ",",
RowBox[{"\[Mu]", "=", "1"}], ",",
RowBox[{"s", "=", "0.02"}], ",",
RowBox[{"K", "=",
RowBox[{"4", " ",
RowBox[{"10", "^", "6"}]}]}], ",",
RowBox[{"U", "=",
RowBox[{"1", " ",
RowBox[{"10", "^",
RowBox[{"-", "6."}]}]}]}], ",",
RowBox[{"maxtime", "=",
RowBox[{"1", " ",
RowBox[{"10", "^", "6."}]}]}], ",",
RowBox[{"initmostfitclass", "=", "20"}]}], "}"}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{"{",
RowBox[{"extime", ",", "extinctiontimes"}], "}"}], "=",
RowBox[{"AbsoluteTiming", "[",
RowBox[{"ParallelTable", "[",
RowBox[{
RowBox[{"{",
RowBox[{"x", ",",
RowBox[{"RunSimulationCheckEachMutation2", "[",
RowBox[{
"r", ",", "\[Mu]", ",", "s", ",", "K", ",", "U", ",", "maxtime",
",", "x", ",", "initmostfitclass"}], "]"}]}], "}"}], ",",
RowBox[{"{",
RowBox[{"x", ",", "180.5", ",", "190", ",", "0.5"}], "}"}], ",",
RowBox[{"Method", "->", "\"\<FinestGrained\>\""}]}], "]"}],
"]"}]}]}], "]"}], ";"}]}]], "Input",
CellChangeTimes->{{3.678135849887076*^9, 3.678135860254983*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"(*",
RowBox[{
RowBox[{"Multiple", " ", "runs", " ", "at", " ", "one", " ", "T"}], ",",
" ", "parallelized"}], "*)"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"With", "[",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"r", "=", "2"}], ",",
RowBox[{"\[Mu]", "=", "1"}], ",",
RowBox[{"s", "=", "0.02"}], ",",
RowBox[{"K", "=",
RowBox[{"4", " ",
RowBox[{"10", "^", "6"}]}]}], ",",
RowBox[{"U", "=",
RowBox[{"1", " ",
RowBox[{"10", "^",
RowBox[{"-", "6."}]}]}]}], ",",
RowBox[{"maxtime", "=",
RowBox[{"2", " ",
RowBox[{"10", "^", "6."}]}]}], ",",
RowBox[{"initmostfitclass", "=", "20"}]}], "}"}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{"{",
RowBox[{"extime", ",", "extinctiontimes"}], "}"}], "=",
RowBox[{"AbsoluteTiming", "[",
RowBox[{"ParallelTable", "[",
RowBox[{
RowBox[{"RunSimulationCheckEachMutation2", "[",
RowBox[{
"r", ",", "\[Mu]", ",", "s", ",", "K", ",", "U", ",", "maxtime",
",", "180", ",", "initmostfitclass"}], "]"}], ",", "100", ",",
RowBox[{"Method", "->", "\"\<FinestGrained\>\""}]}], "]"}],
"]"}]}]}], "]"}], ";"}]}]], "Input",
CellChangeTimes->{{3.6349201467681437`*^9, 3.6349201580387883`*^9}, {
3.634920236762291*^9, 3.6349202478419247`*^9}, 3.63492029828581*^9, {
3.6349203419833093`*^9, 3.6349203552900705`*^9}, {3.634920405727955*^9,
3.634920579062869*^9}, {3.634920622642362*^9, 3.634920660096504*^9}, {
3.6349210546360703`*^9, 3.6349210849188027`*^9}, {3.6349211395399265`*^9,
3.63492122683492*^9}, {3.6349213106687145`*^9, 3.634921316365041*^9}, {
3.634921712062673*^9, 3.634921712236683*^9}, {3.634922293645938*^9,
3.634922299961299*^9}, {3.634923150256933*^9, 3.6349231556472416`*^9}, {
3.634924194870682*^9, 3.634924200056978*^9}, {3.63493609523411*^9,
3.634936095308114*^9}, {3.6349361296730795`*^9, 3.634936129745084*^9}, {
3.6349362766654873`*^9, 3.6349362825568237`*^9}, {3.634936606752367*^9,
3.6349366152858553`*^9}, {3.635005582605888*^9, 3.635005602786042*^9}, {
3.6350058945267286`*^9, 3.6350058947467413`*^9}, {3.6350078874147153`*^9,
3.6350079077848806`*^9}, {3.635012940295724*^9, 3.635012940384729*^9}, {
3.6350140032855234`*^9, 3.6350140045585957`*^9}, {3.6350147425288057`*^9,
3.635014750088238*^9}, 3.6350153941540766`*^9, {3.635041967371011*^9,
3.6350420068382683`*^9}, {3.635067935554306*^9, 3.635067937353409*^9}, {
3.6350680562922115`*^9, 3.6350680671068306`*^9}, {3.6350683372842836`*^9,
3.6350683538562317`*^9}, {3.6350683967276835`*^9,
3.6350684296365657`*^9}, {3.635068548836384*^9, 3.635068572388731*^9}, {
3.635068819781881*^9, 3.6350688463544006`*^9}, {3.635068915064331*^9,
3.635068918326517*^9}, {3.6350758421525373`*^9, 3.635075865026846*^9}, {
3.6350898463075294`*^9, 3.635089861132377*^9}, {3.6350899394508567`*^9,
3.6350899571058664`*^9}, {3.6350899915168347`*^9,
3.6350900127010465`*^9}, {3.6350900494981513`*^9,
3.6350900506542172`*^9}, {3.6350901285556726`*^9,
3.6350901287576847`*^9}, {3.6350903272610383`*^9,
3.6350903282000923`*^9}, {3.635090436229271*^9, 3.6350904461328373`*^9},
3.635091748027302*^9, {3.63509923949741*^9, 3.6350992608586316`*^9}, {
3.6350993008429184`*^9, 3.63509930768531*^9}, {3.635099851986442*^9,
3.6350998520674467`*^9}, {3.635099885622366*^9, 3.63509991104082*^9}, {
3.6351072274352937`*^9, 3.635107249086532*^9}, {3.6351073178734665`*^9,
3.6351073180734777`*^9}, {3.63511341108372*^9, 3.635113425574549*^9}, {
3.6351137481900015`*^9, 3.635113800277981*^9}, {3.6351777871466937`*^9,
3.6351778218446784`*^9}, {3.6351789733485403`*^9, 3.635178973463547*^9}, {
3.6351887696288557`*^9, 3.635188770103883*^9}, {3.635188846853273*^9,
3.6351888735337987`*^9}, {3.635190674133787*^9, 3.6351906950529838`*^9}, {
3.635193446700369*^9, 3.6351934467633724`*^9}, {3.635201878690458*^9,
3.6352018907471476`*^9}, {3.635212858485466*^9, 3.635212866398919*^9}, {
3.635213519738288*^9, 3.635213526002646*^9}, {3.63521365965429*^9,
3.6352136598953037`*^9}, {3.635267251192492*^9, 3.6352672585029106`*^9}, {
3.6352675714938126`*^9, 3.6352675765811033`*^9}, {3.636980915529756*^9,
3.6369809531079054`*^9}, {3.636980998712514*^9, 3.6369810302263165`*^9}, {
3.636981904713334*^9, 3.6369819077055054`*^9}, {3.6369910053958635`*^9,
3.6369910302602854`*^9}, {3.63751643162955*^9, 3.637516431786559*^9}, {
3.6375164687456727`*^9, 3.6375164937821045`*^9}, {3.637516539205703*^9,
3.6375165395467224`*^9}, {3.6375166815208426`*^9,
3.6375166815758457`*^9}, {3.6421667049197536`*^9,
3.6421667066968555`*^9}, {3.6421668702872124`*^9, 3.642166871751296*^9}, {
3.64216693371384*^9, 3.642166950062775*^9}, {3.642167016398569*^9,
3.642167024266019*^9}, {3.6421670777620792`*^9, 3.642167086844599*^9}, {
3.642167266660884*^9, 3.642167266724887*^9}, {3.6421734357347345`*^9,
3.6421734406330147`*^9}, {3.6421737381190295`*^9,
3.6421737381990347`*^9}, {3.6421787093503714`*^9, 3.642178710598443*^9}, {
3.6421787797854004`*^9, 3.6421787798664045`*^9}, {3.642178843018017*^9,
3.6421788510544767`*^9}, {3.64218051869086*^9, 3.6421805215080214`*^9}, {
3.6421824845312996`*^9, 3.6421825094147224`*^9}, {3.642182727472195*^9,
3.6421827405939455`*^9}, {3.642186133822027*^9, 3.6421861338960314`*^9}, {
3.642254016670212*^9, 3.642254016735215*^9}, {3.6422540518482237`*^9,
3.6422540557694483`*^9}, {3.6422541115536385`*^9, 3.642254111820654*^9}, {
3.6422541896021028`*^9, 3.642254192094245*^9}, {3.6422542453222895`*^9,
3.642254248965498*^9}, {3.6422544411534905`*^9, 3.6422544453397303`*^9}, {
3.6422676250582905`*^9, 3.642267628238473*^9}, {3.642267675342167*^9,
3.6422676755121765`*^9}, {3.642267824599704*^9, 3.642267830771057*^9}, {
3.6422727760098004`*^9, 3.6422727760628033`*^9}, {3.6422753141459737`*^9,
3.6422753142279778`*^9}, {3.6433965333174653`*^9,
3.6433965367296605`*^9}, {3.643397346744991*^9, 3.643397398857971*^9}, {
3.6433974964545536`*^9, 3.6433974969345813`*^9}, {3.643461621777214*^9,
3.64346162869361*^9}, {3.643463018489102*^9, 3.6434630307058005`*^9}, {
3.643466264933788*^9, 3.6434662650127926`*^9}, {3.6434667588530383`*^9,
3.6434667680705657`*^9}, {3.643467479295245*^9, 3.643467481261358*^9}, {
3.6434861967812796`*^9, 3.6434861980413513`*^9}, {3.6434862711685343`*^9,
3.643486271239538*^9}, {3.6434864056252246`*^9, 3.643486411543563*^9}, {
3.6435066894648857`*^9, 3.6435066895498905`*^9}, {3.6435067560666947`*^9,
3.6435067630540943`*^9}, {3.643543739086594*^9, 3.6435437438778687`*^9}, {
3.6436355038215547`*^9, 3.6436355102969246`*^9}, {3.643635554934478*^9,
3.643635555003482*^9}, {3.6436360285195656`*^9, 3.643636028665574*^9}, {
3.6436407482955213`*^9, 3.643640773905986*^9}, {3.643641675876576*^9,
3.6436416834050064`*^9}, {3.6436493748780136`*^9,
3.6436493844285593`*^9}, {3.6436503706559687`*^9, 3.643650373182113*^9}, {
3.643838785036136*^9, 3.6438387881583147`*^9}, {3.6439446114741564`*^9,
3.64394462185175*^9}, {3.6441442001088595`*^9, 3.644144200199865*^9}, {
3.6441466073112793`*^9, 3.6441466122245607`*^9}, {3.6441469885540857`*^9,
3.6441469888831043`*^9}, {3.64415169450225*^9, 3.6441516970893984`*^9}, {
3.6441524446151543`*^9, 3.644152446221246*^9}, {3.6441524858975153`*^9,
3.6441524860025215`*^9}, {3.6441532670461946`*^9,
3.6441532868363266`*^9}, {3.644163057675313*^9, 3.6441630729651875`*^9}, {
3.6448064021893225`*^9, 3.6448064139629955`*^9}, {3.644806449649037*^9,
3.6448064543623066`*^9}, {3.644806694232026*^9, 3.644806694460039*^9}, {
3.644847279952955*^9, 3.644847294688798*^9}, {3.644847783886778*^9,
3.6448477931203065`*^9}, {3.6448521007996917`*^9,
3.6448521347486334`*^9}, {3.6453604473177137`*^9,
3.6453605013548045`*^9}, {3.645360904531865*^9, 3.645360906863998*^9}, {
3.645364539605779*^9, 3.645364543091978*^9}, {3.6453761903151617`*^9,
3.6453761907501864`*^9}, {3.645376226073207*^9, 3.645376248124468*^9}, {
3.6453763467761106`*^9, 3.6453763488062267`*^9}, {3.645377465464096*^9,
3.6453775013331475`*^9}, {3.6453776414081593`*^9, 3.645377646865472*^9}, {
3.6453777721476374`*^9, 3.645377782771245*^9}, {3.6453780153665485`*^9,
3.645378021637907*^9}, {3.6590977273636093`*^9, 3.6590977326800823`*^9}, {
3.659097901248513*^9, 3.659097930753409*^9}, {3.659098002234086*^9,
3.659098043082996*^9}, {3.65910625358025*^9, 3.659106253647593*^9}, {
3.6591062865048523`*^9, 3.659106288585147*^9}, {3.6591196793552227`*^9,
3.659119691392786*^9}, {3.659207558284609*^9, 3.659207568212329*^9}, {
3.659208613463871*^9, 3.659208613529354*^9}, {3.659211171748125*^9,
3.659211180967224*^9}, {3.6592112545441113`*^9, 3.659211281206595*^9}, {
3.659299261720582*^9, 3.65929927679056*^9}, {3.659366523637764*^9,
3.659366523788113*^9}, {3.6621363331808314`*^9, 3.6621363492457504`*^9}, {
3.662136643617587*^9, 3.662136648980894*^9}, {3.6621403106663303`*^9,
3.662140319644844*^9}, {3.662152672689398*^9, 3.662152673217428*^9}, {
3.662154604978918*^9, 3.662154605218932*^9}, {3.662156123168754*^9,
3.6621561232617593`*^9}, {3.66215627344835*^9, 3.6621562755624704`*^9}, {
3.6621636509203167`*^9, 3.662163664404088*^9}, {3.662165286370859*^9,
3.6621652896790485`*^9}, {3.6621676065245647`*^9,
3.6621676108378115`*^9}, {3.662168538473869*^9, 3.66216855440178*^9}, {
3.6621710690316086`*^9, 3.662171072048781*^9}, {3.6621711321302176`*^9,
3.6621711507132807`*^9}, {3.6621775102090225`*^9,
3.6621775193665466`*^9}, {3.6641416123351707`*^9, 3.664141661159423*^9}, {
3.664141812538403*^9, 3.6641418241937304`*^9}, {3.66414189049111*^9,
3.664141936355297*^9}, {3.6642009588099537`*^9, 3.664200961935199*^9}, {
3.664201041873835*^9, 3.6642010485196457`*^9}, {3.664201111099964*^9,
3.664201115729475*^9}, {3.664210500878704*^9, 3.6642105060574007`*^9}, {
3.6642112188412867`*^9, 3.66421121892864*^9}, {3.664284812785692*^9,
3.664284838587934*^9}, {3.66429561124657*^9, 3.6642956257899103`*^9}, {
3.674227604565259*^9, 3.674227604763063*^9}, {3.674228544267531*^9,
3.67422854438503*^9}, {3.674247727957684*^9, 3.674247728157202*^9}, {
3.674247815447093*^9, 3.6742478209028463`*^9}, {3.674247885353643*^9,
3.674247892744169*^9}, {3.674300946040601*^9, 3.674300950921803*^9}, {
3.674301979889606*^9, 3.6743019799687233`*^9}, {3.674302585281733*^9,
3.6743025853617477`*^9}, {3.674303221347837*^9, 3.67430324497104*^9}, {
3.6743033140122337`*^9, 3.674303316035833*^9}, {3.6743047398494263`*^9,
3.674304752385015*^9}, {3.674305796321721*^9, 3.674305813475417*^9}, {
3.67430584563411*^9, 3.674305877234283*^9}, {3.6743201521558037`*^9,
3.6743201544876842`*^9}, {3.674320217265046*^9, 3.674320217393064*^9}, {
3.674327245494132*^9, 3.674327247730928*^9}, {3.674405032138249*^9,
3.6744050322216377`*^9}, {3.6744050637842493`*^9, 3.674405063903955*^9}, {
3.674507131368729*^9, 3.6745071367183743`*^9}, {3.6777356886063137`*^9,
3.677735693126767*^9}, {3.677735772263596*^9, 3.677735885080904*^9}, {
3.6778688469653788`*^9, 3.6778688553654423`*^9}, {3.67813586942272*^9,
3.678135886319069*^9}}],
Cell[CellGroupData[{
Cell[BoxData[{
RowBox[{
RowBox[{"extinctiontimesclean", "=",
RowBox[{"Select", "[",
RowBox[{"extinctiontimes", ",",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"#", "[",
RowBox[{"[", "1", "]"}], "]"}], "<",
RowBox[{"2.", "*",
SuperscriptBox["10", "6"]}]}], "&&",
RowBox[{
RowBox[{"#", "[",
RowBox[{"[", "1", "]"}], "]"}], ">", "60000"}]}], "&"}]}], "]"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{"Length", "[", "extinctiontimesclean", "]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"exttimepositions", "=",
RowBox[{"Ceiling", "[",
RowBox[{"extinctiontimesclean", "[",
RowBox[{"[",
RowBox[{"All", ",", "1"}], "]"}], "]"}], "]"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"extinctiontimesclean", "=",
RowBox[{"Table", "[",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"extinctiontimesclean", "[",
RowBox[{"[", "i", "]"}], "]"}], "[",
RowBox[{"[", "2", "]"}], "]"}], "[",
RowBox[{"[",
RowBox[{
RowBox[{
RowBox[{"exttimepositions", "[",
RowBox[{"[", "i", "]"}], "]"}], "-", "60000"}], ";;",
RowBox[{"exttimepositions", "[",
RowBox[{"[", "i", "]"}], "]"}]}], "]"}], "]"}], ",",
RowBox[{"{",
RowBox[{"i", ",", "1", ",",
RowBox[{"Length", "[", "extinctiontimesclean", "]"}]}], "}"}]}],
"]"}]}], ";"}]}], "Input",
CellChangeTimes->{{3.678028623390059*^9, 3.67802862771809*^9}, {
3.678028769097238*^9, 3.678028860825585*^9}, {3.678034158041346*^9,
3.6780341601764393`*^9}, {3.67803657280068*^9, 3.678036602328599*^9}, {
3.6780366973941393`*^9, 3.67803669753092*^9}, 3.678037377063263*^9, {
3.678037555208726*^9, 3.678037555896537*^9}, {3.67803765250721*^9,
3.678037652579402*^9}}],
Cell[BoxData["90"], "Output",
CellChangeTimes->{{3.678036591564561*^9, 3.6780366027277927`*^9}, {
3.6780366878735237`*^9, 3.678036700348461*^9}, 3.678037377725115*^9,
3.678037560029121*^9, 3.678037653396838*^9}]
}, Open ]],
Cell[BoxData[
RowBox[{
RowBox[{"Export", "[",
RowBox[{
"\"\</home/jbertram/repos/popgenextinction/code/test.csv\>\"", ",",
"extinctiontimesclean"}], "]"}], ";"}]], "Input",
CellChangeTimes->{{3.674660717600375*^9, 3.674660771280265*^9},
3.674660806129025*^9, {3.674660966171344*^9, 3.6746609700058603`*^9}, {
3.6746648797825727`*^9, 3.674664888872039*^9}, {3.6778644234389477`*^9,
3.677864459559552*^9}, 3.677864508825844*^9}],
Cell[BoxData[
RowBox[{
RowBox[{"(*",
RowBox[{
RowBox[{"Markov", " ", "chain", " ", "simulation"}], ";", " ",
RowBox[{"multiple", " ", "mutations"}]}], "*)"}], "\[IndentingNewLine]",
RowBox[{"(*", "Memoryless", "*)"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"timebetweenenvchanges", "=", "180"}], ";"}],
"\[IndentingNewLine]",
RowBox[{
RowBox[{"M", "=",
RowBox[{
RowBox[{"Floor", "[",
RowBox[{
RowBox[{"(",
RowBox[{"r", "-", "\[Mu]"}], ")"}], "/", "s"}], "]"}], "+", "1"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"lambdas", "=",
RowBox[{"Table", "[",
RowBox[{
RowBox[{"1", "/", "timebetweenenvchanges"}], ",",
RowBox[{"{",
RowBox[{"i", ",", "0", ",",
RowBox[{"M", "-", "1"}]}], "}"}]}], "]"}]}], ";"}],
"\[IndentingNewLine]",
RowBox[{
RowBox[{"mus", "=",
RowBox[{"Prepend", "[",
RowBox[{
RowBox[{"Table", "[",
RowBox[{
RowBox[{
RowBox[{"(", " ",
RowBox[{
RowBox[{"2",
RowBox[{"Log", "[", " ",
RowBox[{
RowBox[{"K", "/", "r"}],
RowBox[{"(",
RowBox[{"r", "-", "\[Mu]", "-",
RowBox[{"i", " ", "s"}]}], ")"}], "s"}], "]"}]}], "-",
RowBox[{"Log", "[", " ",
RowBox[{"s", "/",
RowBox[{"(",
RowBox[{"U", " ", "i"}], ")"}]}], "]"}]}], ")"}],
RowBox[{"s", "/",
RowBox[{
RowBox[{"(",
RowBox[{"Log", "[",
RowBox[{"s", "/",
RowBox[{"(",
RowBox[{"U", " ", "i"}], ")"}]}], "]"}], ")"}], "^",
"2"}]}]}], ",",
RowBox[{"{",
RowBox[{"i", ",", "1", ",",
RowBox[{"M", "-", "1"}]}], "}"}]}], "]"}], ",", "0"}], "]"}]}],
";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"A", "=",
RowBox[{"ConstantArray", "[",
RowBox[{"0", ",",
RowBox[{"{",
RowBox[{"M", ",", "M"}], "}"}]}], "]"}]}], ";"}],
"\[IndentingNewLine]",
RowBox[{
RowBox[{"For", "[",
RowBox[{
RowBox[{"i", "=", "2"}], ",",
RowBox[{"i", "\[LessEqual]", " ",
RowBox[{"M", "-", "1"}]}], ",",
RowBox[{"i", "++"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"A", "[",
RowBox[{"[", "i", "]"}], "]"}], "[",
RowBox[{"[",
RowBox[{"i", "-", "1"}], "]"}], "]"}], "=",
RowBox[{"mus", "[",
RowBox[{"[", "i", "]"}], "]"}]}], ";", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"A", "[",
RowBox[{"[", "i", "]"}], "]"}], "[",
RowBox[{"[", "i", "]"}], "]"}], "=",
RowBox[{"1", "-",
RowBox[{"lambdas", "[",
RowBox[{"[", "i", "]"}], "]"}], "-",
RowBox[{"mus", "[",
RowBox[{"[", "i", "]"}], "]"}]}]}], ";", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"A", "[",
RowBox[{"[", "i", "]"}], "]"}], "[",
RowBox[{"[",
RowBox[{"i", "+", "1"}], "]"}], "]"}], "=",
RowBox[{"lambdas", "[",
RowBox[{"[", "i", "]"}], "]"}]}]}]}], "]"}], ";"}],
"\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"A", "[",
RowBox[{"[", "1", "]"}], "]"}], "[",
RowBox[{"[", "1", "]"}], "]"}], "=",
RowBox[{"1", "-",
RowBox[{"lambdas", "[",
RowBox[{"[", "1", "]"}], "]"}]}]}], ";", " ",
RowBox[{
RowBox[{
RowBox[{"A", "[",
RowBox[{"[", "1", "]"}], "]"}], "[",
RowBox[{"[", "2", "]"}], "]"}], "=",
RowBox[{"lambdas", "[",
RowBox[{"[", "1", "]"}], "]"}]}], ";"}], " ", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{
RowBox[{"A", "[",
RowBox[{"[", "M", "]"}], "]"}], "[",
RowBox[{"[", "M", "]"}], "]"}], "=", "1"}], ";"}], " "}]}]], "Input",
CellChangeTimes->{{3.6352975866897507`*^9, 3.6352976099470806`*^9}, {
3.635298033664316*^9, 3.635298108339587*^9}, {3.635298265768592*^9,
3.635298377442979*^9}, 3.635298683292473*^9, {3.6352993037589617`*^9,
3.635299303857967*^9}, {3.6355306482001743`*^9, 3.6355306486782017`*^9}, {
3.635530691428647*^9, 3.635530707895589*^9}, 3.635530893922229*^9, {
3.635531010480896*^9, 3.635531010670907*^9}, {3.6357756463854218`*^9,
3.6357756476404934`*^9}, 3.635775687691784*^9, {3.635775854460323*^9,
3.635775907427352*^9}, {3.6375175663764534`*^9, 3.6375175665874653`*^9}, {
3.6375179570157967`*^9, 3.6375179570577993`*^9}, {3.637518063586892*^9,
3.637518063650896*^9}, {3.637523515310954*^9, 3.637523533577999*^9}, {
3.637524213497888*^9, 3.637524216433056*^9}, {3.637524291476348*^9,
3.6375242922123904`*^9}, {3.6375247356037507`*^9, 3.637524735733758*^9}, {
3.637524963175767*^9, 3.637524963240771*^9}, {3.6375251610870867`*^9,
3.637525161171092*^9}, {3.637525280340908*^9, 3.6375252816979856`*^9}, {
3.6375254495805883`*^9, 3.6375254504526377`*^9}, {3.6375255532865195`*^9,
3.6375255534115267`*^9}, {3.6375256575874853`*^9,
3.6375256581345167`*^9}, {3.6375935054627953`*^9,
3.6375935062878428`*^9}, {3.637595427641738*^9, 3.6375954277107415`*^9}, {
3.63759573626239*^9, 3.6375957363433943`*^9}, {3.637603160306637*^9,
3.6376031603966417`*^9}, {3.637607159205361*^9, 3.6376071593393683`*^9}, {
3.6376072382278805`*^9, 3.637607264577388*^9}, 3.637607349794262*^9, {
3.6376075834606266`*^9, 3.637607584201669*^9}, {3.637610707683322*^9,
3.6376107077793274`*^9}, {3.6385407954537115`*^9,
3.6385407955387163`*^9}, {3.6453227654917717`*^9, 3.6453227670368605`*^9},
3.6453230476339097`*^9, {3.6453568378902664`*^9, 3.645356838076277*^9}, {
3.645357008610031*^9, 3.645357008681035*^9}, {3.6453580257942104`*^9,
3.6453580258822155`*^9}, {3.645383466311325*^9, 3.645383466392329*^9}, {
3.6454060918525147`*^9, 3.645406091926519*^9}, {3.658691502388154*^9,
3.658691508466279*^9}, {3.658691889458805*^9, 3.658691897763215*^9}, {
3.659358124621929*^9, 3.659358138685804*^9}, {3.659358732439817*^9,
3.659358738793239*^9}, 3.659358875255814*^9, {3.6593591246267977`*^9,
3.65935912472268*^9}, {3.659377527847308*^9, 3.659377532359108*^9}, {
3.659463048617651*^9, 3.659463052400468*^9}, {3.6621776360192184`*^9,
3.6621776411215105`*^9}, {3.662224376084002*^9, 3.662224376316346*^9}, {
3.662224754202078*^9, 3.662224754698958*^9}, {3.66223054764764*^9,
3.662230548324242*^9}, {3.662237134346518*^9, 3.662237134601063*^9}, {
3.6633339977274313`*^9, 3.663333997950039*^9}, {3.663345621174464*^9,
3.66334562170473*^9}, {3.663591436398202*^9, 3.663591436502994*^9}, {
3.67819868303575*^9, 3.678198687635519*^9}}],
Cell[BoxData[{
RowBox[{
RowBox[{"CMFmatrix", "=",
RowBox[{"ConstantArray", "[",
RowBox[{"0", ",",
RowBox[{"{",
RowBox[{"M", ",", "M"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]",
RowBox[{"For", "[",
RowBox[{
RowBox[{"i", "=", "1"}], ",",
RowBox[{"i", "\[LessEqual]", "M"}], ",",
RowBox[{"i", "++"}], ",",
RowBox[{
RowBox[{"CMFmatrix", "[",
RowBox[{"[", "i", "]"}], "]"}], "=",
RowBox[{"Accumulate", "[",
RowBox[{"A", "[",
RowBox[{"[", "i", "]"}], "]"}], "]"}]}]}], "]"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"simulatetransittime", "[", "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{"rand", ",", "state", ",", "states"}], "}"}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{"state", "=", "40"}], ";",
RowBox[{"i", "=", "1"}], ";", "\[IndentingNewLine]",
RowBox[{"While", "[",
RowBox[{
RowBox[{
RowBox[{"state", "<", "M"}], " ", "&&", " ",
RowBox[{"i", "<", "2000000"}]}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"rand", "=",