-
Notifications
You must be signed in to change notification settings - Fork 0
/
sim_QG_LV.nb
2248 lines (2217 loc) · 101 KB
/
sim_QG_LV.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.1' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 158, 7]
NotebookDataLength[ 103340, 2240]
NotebookOptionsPosition[ 102364, 2202]
NotebookOutlinePosition[ 102703, 2217]
CellTagsIndexPosition[ 102660, 2214]
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[CellGroupData[{
Cell["\<\
This Mathematica notebook simulates a single instance of the quantitative \
genetic Lotka-Volterra model. The results can be plotted, and a movie can be \
made from the dynamics.\
\>", "Subchapter",
CellChangeTimes->{{3.666531537722056*^9, 3.666531663405964*^9}}],
Cell[BoxData[
RowBox[{
RowBox[{"ClearAll", "[", "\"\<Global`*\>\"", "]"}], ";", " ",
RowBox[{"(*", " ",
RowBox[{
"Clear", " ", "all", " ", "variables", " ", "and", " ", "functions"}], " ",
"*)"}]}]], "Input",
CellChangeTimes->{{3.637322032445478*^9, 3.637322036827528*^9}, {
3.6373242932574787`*^9, 3.637324293543751*^9}, {3.6383648674069*^9,
3.638364867680562*^9}, {3.638532509031641*^9, 3.638532509215373*^9}, {
3.638533324407572*^9, 3.6385333247596607`*^9}, {3.6394129161307592`*^9,
3.639412916328513*^9}, {3.642358036420536*^9, 3.6423580371031523`*^9}, {
3.6459748347874107`*^9, 3.6459748350644913`*^9}, {3.647026559735401*^9,
3.647026560092215*^9}, {3.653406427270583*^9, 3.653406427461027*^9}, {
3.657201290652562*^9, 3.657201290809084*^9}, {3.657375696634927*^9,
3.6573756974599457`*^9}, {3.665250407775477*^9, 3.665250408032344*^9}, {
3.666531575876008*^9, 3.6665315866523733`*^9}, {3.666535215008134*^9,
3.6665352158395367`*^9}}],
Cell[CellGroupData[{
Cell["Define parameters", "Section",
CellChangeTimes->{{3.64235860340806*^9, 3.642358605351142*^9}}],
Cell[BoxData[{
RowBox[{
RowBox[{
RowBox[{"S", "=", "2"}], ";", " ",
RowBox[{"(*", " ",
RowBox[{"Number", " ", "of", " ", "species"}], " ", "*)"}],
"\[IndentingNewLine]",
RowBox[{"\[Omega]", "=", "0.1"}], ";", " ",
RowBox[{"(*", " ",
RowBox[{"Width", " ", "of", " ", "competition", " ", "kernel"}], " ",
"*)"}], "\[IndentingNewLine]",
RowBox[{"bshape", "=", "2"}], ";"}], " ",
RowBox[{"(*", " ",
RowBox[{
"Shape", " ", "of", " ", "intrinsic", " ", "fitness", " ", "function"}],
" ", "*)"}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"\[Theta]", "=", "0.5"}], ";"}], " ",
RowBox[{"(*", " ",
RowBox[{
RowBox[{"Effective", " ", "half"}], "-",
RowBox[{"width", " ", "of", " ", "trait", " ", "axis"}]}], " ",
"*)"}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"hsquare", "=", "0.1"}], ";"}], " ",
RowBox[{"(*", " ", "Heritability", " ", "*)"}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{
RowBox[{"\[Sigma]", "[", "1", "]"}], "=", "0.05"}], ",",
RowBox[{
RowBox[{"\[Sigma]", "[", "2", "]"}], "=", "0.1"}]}], "}"}], ";"}], " ",
RowBox[{"(*", " ",
RowBox[{"Intraspecific", " ", "standard", " ", "deviations"}], " ",
"*)"}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"ninit", "=",
RowBox[{"{",
RowBox[{"1", ",", "1"}], "}"}]}], ";", " ",
RowBox[{"(*", " ",
RowBox[{"Initial", " ", "species", " ", "abundances"}], " ", "*)"}],
"\[IndentingNewLine]",
RowBox[{"\[Mu]init", "=",
RowBox[{"{",
RowBox[{
RowBox[{"-", "0.4"}], ",", "0.3"}], "}"}]}], ";", " ",
RowBox[{"(*", " ",
RowBox[{"Initial", " ", "species", " ", "mean", " ", "traits"}], " ",
"*)"}], "\[IndentingNewLine]",
RowBox[{"c", "=", "0"}], ";", " ",
RowBox[{"(*", " ",
RowBox[{
RowBox[{"Asymmetry", " ", "parameter"}], ";", " ",
RowBox[{
"leave", " ", "it", " ", "at", " ", "0", " ", "for", " ", "unperturbed",
" ", "case"}]}], " ", "*)"}], "\[IndentingNewLine]",
RowBox[{"extinctionthreshold", "=", "0.001"}], ";", " ",
RowBox[{"(*", " ",
RowBox[{"Extinction", " ",
RowBox[{"threshold", ":", " ",
RowBox[{
"species", " ", "below", " ", "this", " ", "density", " ", "will", " ",
"be", " ", "considered", " ",
RowBox[{"extinct", "."}]}]}]}], " ", "*)"}], "\[IndentingNewLine]",
RowBox[{"alleethreshold", "=",
RowBox[{"10.0", "^",
RowBox[{"(",
RowBox[{"-", "20"}], ")"}]}]}], ";", " ",
RowBox[{"(*", " ",
RowBox[{
"Threshold", " ", "density", " ", "at", " ", "which", " ", "weak", " ",
"Allee", " ", "effect", " ", "kicks", " ", "in"}], " ",
"*)"}]}]}], "Input",
CellChangeTimes->{{3.637323906055581*^9, 3.6373239069971848`*^9}, {
3.637323999383214*^9, 3.6373241234613867`*^9}, {3.637324155429853*^9,
3.637324282251281*^9}, {3.63732465636528*^9, 3.637324675731101*^9}, {
3.6373250820796957`*^9, 3.637325084891239*^9}, {3.6373251908219852`*^9,
3.637325306088502*^9}, {3.6373258334498167`*^9, 3.637325848793543*^9},
3.6373258992101097`*^9, {3.637326025445652*^9, 3.6373260275075293`*^9}, {
3.637326122468053*^9, 3.6373261225075083`*^9}, {3.6373263529451838`*^9,
3.637326380316525*^9}, {3.6373265436105633`*^9, 3.637326543825912*^9}, {
3.637326606212639*^9, 3.6373266680816936`*^9}, 3.637326725365484*^9, {
3.637326829719483*^9, 3.6373268298608418`*^9}, {3.63732707292525*^9,
3.637327072991509*^9}, {3.637327124014235*^9, 3.6373271240638657`*^9}, {
3.6373274488043957`*^9, 3.637327475884759*^9}, {3.63732788247045*^9,
3.637327882527525*^9}, {3.637333635406342*^9, 3.637333635584737*^9}, {
3.6373381313020782`*^9, 3.637338165528141*^9}, {3.6373386351436768`*^9,
3.637338655921454*^9}, {3.6373395637031107`*^9, 3.637339567758863*^9},
3.63734253314994*^9, {3.637342564255197*^9, 3.637342683968967*^9}, {
3.6373438033400297`*^9, 3.637343803397814*^9}, {3.6373454362013407`*^9,
3.6373454511662817`*^9}, {3.6373458545460052`*^9, 3.637345865153141*^9}, {
3.6373460206271763`*^9, 3.6373460207236423`*^9}, {3.637346114298715*^9,
3.637346114427808*^9}, {3.6373464930777407`*^9, 3.637346493148085*^9},
3.637346922102119*^9, 3.637347359092807*^9, {3.637347575156708*^9,
3.637347575376601*^9}, {3.637347615317676*^9, 3.637347616236657*^9}, {
3.637348993770691*^9, 3.637349043150106*^9}, {3.637407331433824*^9,
3.637407331456484*^9}, {3.637407494333578*^9, 3.637407494573915*^9}, {
3.6374075327818413`*^9, 3.637407532839367*^9}, {3.637407672941969*^9,
3.637407703440935*^9}, 3.63740790413592*^9, 3.637409098013845*^9,
3.637409190571331*^9, {3.637409421942649*^9, 3.63740942200233*^9},
3.63740949999189*^9, {3.637409592634089*^9, 3.637409594114645*^9}, {
3.6374097415112057`*^9, 3.637409741718253*^9}, {3.6374098657139683`*^9,
3.637409883474079*^9}, {3.6374103902118683`*^9, 3.637410444798923*^9}, {
3.637410487626586*^9, 3.637410507451079*^9}, {3.637410571962682*^9,
3.637410572008903*^9}, {3.6374106129660997`*^9, 3.637410653305173*^9}, {
3.637410684787056*^9, 3.637410735607061*^9}, {3.637415439478067*^9,
3.637415478565694*^9}, 3.637415525189521*^9, {3.637415582466798*^9,
3.637415607789262*^9}, {3.63741598198514*^9, 3.6374160105917397`*^9}, {
3.6374161318871737`*^9, 3.6374161337391148`*^9}, {3.637416164177808*^9,
3.637416167304785*^9}, 3.637424829536097*^9, {3.6374248830274363`*^9,
3.6374249155261374`*^9}, {3.6374249722631083`*^9,
3.6374249738637533`*^9}, {3.6374250115022*^9, 3.637425014165875*^9},
3.637425067374452*^9, {3.6374251117949457`*^9, 3.6374251142610397`*^9}, {
3.637434614130199*^9, 3.6374346462079563`*^9}, {3.637434705234571*^9,
3.6374347052826138`*^9}, {3.637434757851767*^9, 3.637434764226708*^9}, {
3.63743522489544*^9, 3.637435245822134*^9}, {3.637435281223735*^9,
3.637435331682431*^9}, {3.637435387146265*^9, 3.637435387266706*^9}, {
3.637435953363758*^9, 3.637435959690752*^9}, {3.637435990711948*^9,
3.6374360006998863`*^9}, {3.63743632924397*^9, 3.637436336770651*^9}, {
3.637436374680633*^9, 3.637436451606439*^9}, {3.637436655377561*^9,
3.6374366665604067`*^9}, {3.637436722062868*^9, 3.637436838627943*^9}, {
3.6374370230625467`*^9, 3.6374370238473597`*^9}, {3.637437100219316*^9,
3.637437108472042*^9}, {3.637493667221655*^9, 3.6374936708222313`*^9}, {
3.637493982953842*^9, 3.6374939837612886`*^9}, {3.63749419194795*^9,
3.637494191998658*^9}, {3.637494233158271*^9, 3.637494249137557*^9}, {
3.6374943325378103`*^9, 3.6374943628380413`*^9}, {3.637494393666587*^9,
3.637494393681093*^9}, {3.63749449563174*^9, 3.6374944962247066`*^9}, {
3.6374946399249277`*^9, 3.6374946545514603`*^9}, {3.637494859701985*^9,
3.637494868229827*^9}, {3.6374981048110943`*^9, 3.637498131541048*^9}, {
3.6375192320344954`*^9, 3.6375193279280453`*^9}, {3.637519362714039*^9,
3.637519362797782*^9}, {3.637519417916285*^9, 3.637519417984071*^9},
3.6375194485515127`*^9, {3.637583870825931*^9, 3.637583875448186*^9}, {
3.637584007352427*^9, 3.637584024030242*^9}, {3.637584140263015*^9,
3.6375841433376493`*^9}, {3.6375970566663227`*^9,
3.6375970567211313`*^9}, {3.637597097815282*^9, 3.637597113267077*^9}, {
3.6375972513295813`*^9, 3.6375972912070837`*^9}, {3.637597446824109*^9,
3.6375975120469112`*^9}, {3.637597608512631*^9, 3.637597610274499*^9}, {
3.637597999638496*^9, 3.637597999698633*^9}, {3.6375991636671247`*^9,
3.637599261822106*^9}, {3.637600521066596*^9, 3.6376005215111628`*^9}, {
3.637600744256585*^9, 3.6376007553168097`*^9}, 3.63760079147396*^9, {
3.637600835982256*^9, 3.637600836222459*^9}, {3.6376010079060717`*^9,
3.6376010117848682`*^9}, {3.637601085296183*^9, 3.637601089470673*^9}, {
3.6376011777915993`*^9, 3.63760120960323*^9}, {3.6376015236322823`*^9,
3.637601536311891*^9}, {3.637601577637669*^9, 3.6376015798875427`*^9},
3.637601641799447*^9, {3.637601725121057*^9, 3.6376017282397947`*^9},
3.637601827794971*^9, {3.6376024572662992`*^9, 3.637602500574218*^9}, {
3.637602573655258*^9, 3.637602598816752*^9}, {3.6376026338468027`*^9,
3.6376026366810207`*^9}, {3.637602681821498*^9, 3.637602707401373*^9}, {
3.637602827945928*^9, 3.637602871001251*^9}, {3.637602912810763*^9,
3.637602920873973*^9}, {3.637602987716037*^9, 3.637603002497604*^9}, {
3.637603215950582*^9, 3.637603252366889*^9}, {3.637603405803944*^9,
3.637603405930488*^9}, {3.637603531882564*^9, 3.637603542356455*^9}, {
3.637605648368976*^9, 3.63760571633867*^9}, {3.637605771198394*^9,
3.6376057758174467`*^9}, {3.6376058111221657`*^9, 3.637605823100203*^9}, {
3.6376064048944387`*^9, 3.637606408326384*^9}, {3.637606452749897*^9,
3.6376064603100243`*^9}, {3.637606515896676*^9, 3.637606519638255*^9}, {
3.637606580647134*^9, 3.637606581646905*^9}, {3.637607637599104*^9,
3.637607640435411*^9}, {3.637607699600855*^9, 3.6376077023944893`*^9}, {
3.637607746577568*^9, 3.637607747165612*^9}, {3.6377908573357286`*^9,
3.6377909603771267`*^9}, {3.6377909968147373`*^9, 3.637791008402213*^9}, {
3.637791070649514*^9, 3.637791158391266*^9}, {3.637791200354865*^9,
3.637791207375949*^9}, {3.6377913417864532`*^9, 3.637791375717906*^9}, {
3.637791521849167*^9, 3.637791543985587*^9}, {3.6377916311127462`*^9,
3.637791668474082*^9}, {3.637791701919332*^9, 3.6377917231587267`*^9}, {
3.637791764512148*^9, 3.637791862228148*^9}, {3.637791895443688*^9,
3.637792028404265*^9}, {3.637921886875002*^9, 3.6379219548605022`*^9}, {
3.637922055593925*^9, 3.637922108706856*^9}, {3.637922148582035*^9,
3.637922163709278*^9}, {3.637922249995422*^9, 3.637922250123817*^9}, {
3.637922299182032*^9, 3.637922320121777*^9}, {3.637922354658469*^9,
3.63792238087038*^9}, {3.6379225120470133`*^9, 3.637922641609519*^9}, {
3.637922690359171*^9, 3.637922836780622*^9}, {3.6379230754978247`*^9,
3.637923081808382*^9}, {3.637923450954458*^9, 3.637923451422333*^9}, {
3.637923481686983*^9, 3.6379234872417307`*^9}, {3.6379237912751617`*^9,
3.63792384703006*^9}, {3.6379239126789722`*^9, 3.637923912886754*^9}, {
3.637924162255375*^9, 3.63792418734625*^9}, {3.6379247558633966`*^9,
3.637924756394526*^9}, {3.637924879138015*^9, 3.6379248795504704`*^9}, {
3.637925569067246*^9, 3.637925581504634*^9}, {3.6379256561226997`*^9,
3.637925656266303*^9}, {3.637925691843614*^9, 3.637925692025484*^9}, {
3.637925929216301*^9, 3.637926029279552*^9}, {3.6379260653247833`*^9,
3.63792606803548*^9}, {3.637926133482608*^9, 3.637926133795977*^9}, {
3.637926247774279*^9, 3.637926319062332*^9}, {3.637926382991959*^9,
3.637926383268816*^9}, {3.637926430375128*^9, 3.6379264875422564`*^9}, {
3.6379265426787558`*^9, 3.637926565748972*^9}, {3.6379267087917337`*^9,
3.637926708985455*^9}, {3.6379267446906424`*^9, 3.637926744795785*^9}, {
3.637926809917058*^9, 3.6379268100312433`*^9}, {3.6379288148109093`*^9,
3.6379288222036877`*^9}, {3.637928901241593*^9, 3.637928949674711*^9}, {
3.637929050132306*^9, 3.6379290502384233`*^9}, {3.637929114751781*^9,
3.6379291244223146`*^9}, {3.6379291590897913`*^9,
3.6379291938626757`*^9}, {3.637929985637608*^9, 3.63792998813877*^9}, {
3.637930141430283*^9, 3.6379301431990023`*^9}, {3.6379331825348*^9,
3.637933182589285*^9}, {3.637933224271427*^9, 3.637933239736546*^9}, {
3.637933297854197*^9, 3.637933297928589*^9}, {3.637933333074827*^9,
3.637933334452057*^9}, {3.637933374245302*^9, 3.6379333743471107`*^9}, {
3.6379348642044153`*^9, 3.637934864249907*^9}, {3.6379401920589647`*^9,
3.637940192141734*^9}, {3.6379403375230913`*^9, 3.63794033759634*^9}, {
3.637940506555279*^9, 3.637940506740992*^9}, {3.637940904175118*^9,
3.637940933598629*^9}, {3.637941234679309*^9, 3.637941234775022*^9}, {
3.637941841195986*^9, 3.6379418420108633`*^9}, {3.637941886350124*^9,
3.6379418897736053`*^9}, {3.637941923779004*^9, 3.637942035274723*^9}, {
3.637942088742352*^9, 3.637942092223345*^9}, {3.6379426686268663`*^9,
3.637942696274214*^9}, {3.637942923555986*^9, 3.6379429343697023`*^9}, {
3.637943021480028*^9, 3.637943022531377*^9}, {3.637943114357884*^9,
3.63794312011049*^9}, {3.637943212772897*^9, 3.6379432391976547`*^9}, {
3.637943322990294*^9, 3.637943323075344*^9}, {3.637943367704681*^9,
3.637943367840478*^9}, {3.637943415730082*^9, 3.637943466503332*^9}, {
3.6379435366757917`*^9, 3.6379435492874527`*^9}, {3.6379437627430696`*^9,
3.637943837740946*^9}, {3.637944098754054*^9, 3.637944109650585*^9}, {
3.63794418694245*^9, 3.6379442098636417`*^9}, {3.6379589414027967`*^9,
3.637959178877905*^9}, {3.63801930400299*^9, 3.6380193262122602`*^9}, {
3.638019428491515*^9, 3.6380194287005777`*^9}, {3.638030273803698*^9,
3.6380302830675297`*^9}, {3.638031636271735*^9, 3.6380317597242517`*^9},
3.63803182165773*^9, {3.638031963182974*^9, 3.6380319635464277`*^9}, {
3.638032323800128*^9, 3.6380323399137287`*^9}, {3.638032796754457*^9,
3.638032796811038*^9}, {3.638033643234438*^9, 3.638033647098386*^9}, {
3.638033759419753*^9, 3.63803375960011*^9}, {3.638033805293663*^9,
3.638033805625352*^9}, {3.6380341182933073`*^9, 3.6380341357608643`*^9}, {
3.638034282630949*^9, 3.638034282713497*^9}, {3.6380344169346*^9,
3.63803441930997*^9}, {3.638056651566983*^9, 3.638056651953435*^9}, {
3.6380567118234043`*^9, 3.638056711891816*^9}, {3.6380993701756573`*^9,
3.638099467488538*^9}, {3.638101400142997*^9, 3.638101414325549*^9}, {
3.63810177538827*^9, 3.638101788079268*^9}, {3.6381018299577827`*^9,
3.6381018303603163`*^9}, {3.638102435754623*^9, 3.638102438045867*^9}, {
3.6381025249861526`*^9, 3.638102532059536*^9}, {3.638102613377679*^9,
3.638102613568591*^9}, {3.638102896055628*^9, 3.638102918943692*^9}, {
3.638102958381318*^9, 3.638102966004038*^9}, {3.638103031712606*^9,
3.638103047223345*^9}, {3.638103269905366*^9, 3.638103270568515*^9}, {
3.63810448139916*^9, 3.6381044815208473`*^9}, {3.638105013881518*^9,
3.6381050139658318`*^9}, {3.638105054873653*^9, 3.638105059073758*^9}, {
3.63810513098853*^9, 3.6381051748270884`*^9}, {3.638105312737569*^9,
3.638105322099885*^9}, {3.638105486952003*^9, 3.638105487158422*^9}, {
3.638105518320182*^9, 3.6381055183548326`*^9}, {3.638105628537578*^9,
3.638105651033298*^9}, {3.638111932022522*^9, 3.638111961526692*^9},
3.638112033736128*^9, {3.638112336705029*^9, 3.6381123370236273`*^9}, {
3.638112483645105*^9, 3.638112509625901*^9}, {3.638112607693276*^9,
3.638112607967648*^9}, {3.6381995066107607`*^9, 3.638199516269198*^9}, {
3.638199707199748*^9, 3.638199792339575*^9}, {3.6381998799902678`*^9,
3.638199880116393*^9}, {3.638199914978506*^9, 3.6381999882656183`*^9}, {
3.6382000213571663`*^9, 3.638200087056262*^9}, {3.6382028474277897`*^9,
3.638202891870338*^9}, {3.638202977846723*^9, 3.638202978098991*^9}, {
3.63820303010563*^9, 3.6382030301292963`*^9}, {3.638203111433742*^9,
3.638203152605165*^9}, {3.638203839123115*^9, 3.6382038430319138`*^9}, {
3.638205011211116*^9, 3.638205011288268*^9}, {3.638209372337071*^9,
3.638209401855874*^9}, {3.638209562429359*^9, 3.638209709721245*^9}, {
3.638274019496421*^9, 3.63827402871567*^9}, {3.638274083609967*^9,
3.6382740839780283`*^9}, {3.638274133444561*^9, 3.638274133706822*^9}, {
3.638274243974236*^9, 3.638274301832436*^9}, {3.6382743501212177`*^9,
3.6382744164385567`*^9}, {3.638275458258923*^9, 3.638275461445537*^9}, {
3.6382756652945137`*^9, 3.6382756654265823`*^9}, {3.6382774206025143`*^9,
3.638277420857448*^9}, {3.6382775256362953`*^9, 3.638277526005548*^9}, {
3.638277707232119*^9, 3.638277707288663*^9}, {3.638277758132592*^9,
3.638277783342836*^9}, {3.638277814417675*^9, 3.6382778280883493`*^9}, {
3.638277882603056*^9, 3.638277882876361*^9}, {3.638277919064485*^9,
3.6382779407819347`*^9}, 3.638278054885634*^9, {3.638278240889655*^9,
3.63827824217197*^9}, 3.638278272257803*^9, {3.6382853677739143`*^9,
3.638285399690834*^9}, 3.638285514207137*^9, {3.638285563265503*^9,
3.638285563551197*^9}, {3.638285760824193*^9, 3.63828576301655*^9}, {
3.638285912982288*^9, 3.6382859416028633`*^9}, {3.638285977403673*^9,
3.638285988743142*^9}, 3.638286392326603*^9, {3.638286447072227*^9,
3.638286457347769*^9}, {3.6382865260117702`*^9, 3.6382865643800507`*^9}, {
3.6382870233225813`*^9, 3.638287036037204*^9}, {3.638287240952755*^9,
3.6382872414082727`*^9}, {3.638287289152892*^9, 3.638287289981902*^9}, {
3.6382874777566032`*^9, 3.638287486145833*^9}, {3.6382875640321627`*^9,
3.638287565655608*^9}, {3.638287713799533*^9, 3.63828772330262*^9}, {
3.6383660463716087`*^9, 3.638366078525539*^9}, {3.638366111970969*^9,
3.638366112904819*^9}, {3.638367040759643*^9, 3.63836704099564*^9}, {
3.6383670873812304`*^9, 3.638367087775338*^9}, {3.638367242126135*^9,
3.638367242925589*^9}, {3.638367500774358*^9, 3.638367528109301*^9}, {
3.638367558539526*^9, 3.63836756396308*^9}, {3.638367681055359*^9,
3.638367681132971*^9}, {3.638367739190337*^9, 3.638367827659762*^9}, {
3.6383972655785637`*^9, 3.63839726573223*^9}, {3.6383973476877613`*^9,
3.6383973477928743`*^9}, {3.6383974734990892`*^9, 3.638397481135495*^9}, {
3.638397606395254*^9, 3.63839760731559*^9}, {3.638397720194149*^9,
3.63839772046478*^9}, {3.638397796472189*^9, 3.638397796524542*^9}, {
3.6383978812464046`*^9, 3.6383978814643784`*^9}, {3.638397993724799*^9,
3.638398020585668*^9}, {3.638398103574711*^9, 3.638398103655957*^9}, {
3.63839813743314*^9, 3.638398153666362*^9}, {3.6383983633838787`*^9,
3.638398422465392*^9}, {3.638398497240314*^9, 3.638398499900011*^9}, {
3.638398552210623*^9, 3.638398570033655*^9}, {3.638532561655347*^9,
3.6385325617760363`*^9}, {3.638532983887035*^9, 3.638532984927305*^9}, {
3.6385332323304033`*^9, 3.638533233153509*^9}, {3.6385343953624907`*^9,
3.6385344058027697`*^9}, {3.638534534129569*^9, 3.638534690316371*^9}, {
3.6385347788409557`*^9, 3.6385347867272797`*^9}, {3.6385348714123697`*^9,
3.638534872353663*^9}, {3.638534912550179*^9, 3.63853491353174*^9}, {
3.6385352408159847`*^9, 3.6385352648527308`*^9}, {3.638535960230736*^9,
3.6385359916298037`*^9}, {3.638536086768046*^9, 3.638536118022052*^9}, {
3.6385361680236*^9, 3.63853616809163*^9}, 3.638538182128735*^9, {
3.638538271210775*^9, 3.638538271499494*^9}, {3.6385390396626577`*^9,
3.638539039827161*^9}, 3.6385392520984287`*^9, {3.6385393067569933`*^9,
3.638539306948625*^9}, {3.638539340487608*^9, 3.638539365848493*^9}, {
3.638546369938863*^9, 3.638546376896723*^9}, {3.638546481100771*^9,
3.6385464811825523`*^9}, {3.6385465195574303`*^9, 3.638546540621052*^9}, {
3.638548424690008*^9, 3.638548424790173*^9}, {3.638548675409285*^9,
3.6385486778113194`*^9}, {3.63854874274758*^9, 3.6385487441457577`*^9}, {
3.638549857516398*^9, 3.638549857635536*^9}, {3.638549958190222*^9,
3.638549958335751*^9}, {3.638551270140708*^9, 3.638551270320745*^9}, {
3.638552061573798*^9, 3.638552100053794*^9}, {3.638552146535627*^9,
3.638552146785301*^9}, {3.638552252465836*^9, 3.638552252540509*^9}, {
3.638552366429947*^9, 3.638552376956636*^9}, {3.638552508877253*^9,
3.638552508967688*^9}, {3.6385528339565372`*^9, 3.638552856513927*^9}, {
3.638552945912756*^9, 3.6385529461678133`*^9}, {3.638553087000824*^9,
3.638553087100827*^9}, {3.638553634310142*^9, 3.638553635813142*^9}, {
3.638553808686015*^9, 3.638553843278699*^9}, {3.638553959018697*^9,
3.638553967220155*^9}, {3.638611842329739*^9, 3.638611842754554*^9}, {
3.6386118845641203`*^9, 3.638611884827475*^9}, {3.6386247312805567`*^9,
3.638624836768318*^9}, {3.638624924463909*^9, 3.63862492773818*^9}, {
3.63862499149793*^9, 3.6386249984867487`*^9}, {3.638625524706019*^9,
3.638625545150094*^9}, {3.638639328279882*^9, 3.638639328577256*^9}, {
3.638639427160982*^9, 3.638639485888158*^9}, {3.6386395943889914`*^9,
3.6386396116434193`*^9}, {3.639068432906582*^9, 3.639068498003413*^9}, {
3.6390815238804007`*^9, 3.6390815241586237`*^9}, {3.639081567340516*^9,
3.639081588336006*^9}, {3.639081623706705*^9, 3.639081642691073*^9}, {
3.639081813736978*^9, 3.639081813853978*^9}, {3.639081854026763*^9,
3.63908185413708*^9}, {3.639081891091502*^9, 3.6390818928144827`*^9}, {
3.640001001750854*^9, 3.6400010018119793`*^9}, {3.640001398809689*^9,
3.6400013988992453`*^9}, {3.640426742382926*^9, 3.640426742611973*^9}, {
3.640426795155561*^9, 3.640426795492395*^9}, {3.640972519890709*^9,
3.640972520657415*^9}, {3.640976139266201*^9, 3.640976139987727*^9},
3.64097644611994*^9, {3.640977034700265*^9, 3.640977034756303*^9}, {
3.640977070644167*^9, 3.6409773405898743`*^9}, {3.640977378105872*^9,
3.640977466460835*^9}, {3.640977503658128*^9, 3.640977581583247*^9}, {
3.640977705951996*^9, 3.640977712051573*^9}, {3.640977746041244*^9,
3.640977799319376*^9}, {3.641044392512186*^9, 3.641044402094944*^9}, {
3.6419221119458933`*^9, 3.641922112183074*^9}, {3.6419221446239977`*^9,
3.6419221499680147`*^9}, {3.641922189680958*^9, 3.641922235449548*^9}, {
3.64192227182691*^9, 3.641922288122913*^9}, {3.641922326252035*^9,
3.6419223902130632`*^9}, {3.64192242308716*^9, 3.6419224707981358`*^9}, {
3.641922503351529*^9, 3.6419225326897306`*^9}, {3.641922597281589*^9,
3.641922597585002*^9}, {3.6419226474425507`*^9, 3.64192264767416*^9}, {
3.641922720085156*^9, 3.6419227224204893`*^9}, {3.641922778758369*^9,
3.6419227815976152`*^9}, {3.641922830814588*^9, 3.641922832854167*^9}, {
3.641922870135681*^9, 3.6419228712876177`*^9}, {3.6419229797855473`*^9,
3.641922980025116*^9}, {3.641923045907174*^9, 3.641923069186726*^9}, {
3.641923195997897*^9, 3.641923198597527*^9}, {3.641923250126828*^9,
3.641923250190344*^9}, {3.641923304025666*^9, 3.641923304064242*^9},
3.641923430418652*^9, {3.641923500876956*^9, 3.64192350094844*^9}, {
3.6421772404037724`*^9, 3.642177323813819*^9}, {3.6421773720574617`*^9,
3.642177453539198*^9}, {3.642177521681766*^9, 3.642177540727459*^9}, {
3.642177582588399*^9, 3.642177586977412*^9}, {3.642178054863921*^9,
3.6421780688110647`*^9}, {3.642178142345245*^9, 3.642178147010839*^9}, {
3.642178208064569*^9, 3.642178215426922*^9}, {3.642358047392261*^9,
3.6423580821041727`*^9}, {3.642358114237397*^9, 3.642358224913746*^9}, {
3.64235826651331*^9, 3.642358292488559*^9}, {3.642358660464724*^9,
3.642358732211548*^9}, {3.642358767617495*^9, 3.6423590755104847`*^9}, {
3.642359123622438*^9, 3.642359143407686*^9}, {3.64243206961269*^9,
3.642432074998642*^9}, 3.642765530908876*^9, {3.642765653661931*^9,
3.642765656995181*^9}, {3.643127066651965*^9, 3.643127173628474*^9}, {
3.6431272064878817`*^9, 3.643127259073286*^9}, {3.6431273040912113`*^9,
3.643127306953333*^9}, {3.6431274045591097`*^9, 3.643127407642886*^9}, {
3.643127715424384*^9, 3.643127715816627*^9}, {3.643127759958088*^9,
3.643127760367427*^9}, {3.6433856926398087`*^9, 3.6433857109352922`*^9},
3.645101046632819*^9, {3.645101079541151*^9, 3.6451010907742434`*^9}, {
3.645101126624958*^9, 3.645101127504352*^9}, {3.6451011652151613`*^9,
3.6451012435602694`*^9}, {3.645974234571888*^9, 3.645974412938127*^9}, {
3.645974534352577*^9, 3.645974614788389*^9}, {3.645974652851576*^9,
3.64597468947602*^9}, {3.645974729208707*^9, 3.6459747300122967`*^9}, {
3.6459747735987186`*^9, 3.645974775967868*^9}, {3.6459748123605824`*^9,
3.645974822591234*^9}, {3.647026567907674*^9, 3.6470267716077337`*^9}, {
3.647026811784917*^9, 3.647026813033955*^9}, {3.647026950252573*^9,
3.647026999676949*^9}, {3.647109668738291*^9, 3.6471096726790323`*^9}, {
3.647109906379006*^9, 3.6471099213176126`*^9}, {3.647110049670692*^9,
3.64711006779935*^9}, {3.647167254425167*^9, 3.647167276348175*^9}, {
3.647255699328187*^9, 3.647255726644815*^9}, {3.6472557605959682`*^9,
3.647255776540786*^9}, {3.6472565206532907`*^9, 3.647256526233164*^9}, {
3.647256662448279*^9, 3.647256708001225*^9}, {3.647346557658746*^9,
3.647346566115307*^9}, {3.647692414436058*^9, 3.64769243463043*^9}, {
3.6532421197192173`*^9, 3.653242201553773*^9}, {3.653242272785324*^9,
3.653242273273926*^9}, {3.65324231019418*^9, 3.653242335269362*^9}, {
3.653242444380764*^9, 3.653242453847519*^9}, {3.6532428038174953`*^9,
3.653242810373872*^9}, {3.653242929600192*^9, 3.653242929662318*^9}, {
3.65324303471662*^9, 3.653243160572784*^9}, {3.653243196440152*^9,
3.653243206052126*^9}, {3.653243330705192*^9, 3.65324333223866*^9}, {
3.653301052542224*^9, 3.6533011090369873`*^9}, {3.653301208802719*^9,
3.653301319689662*^9}, {3.65330137721299*^9, 3.6533013777719707`*^9}, {
3.653301410141367*^9, 3.653301729616386*^9}, {3.6533061724731607`*^9,
3.6533062213618517`*^9}, {3.6533063351861067`*^9, 3.653306509300482*^9}, {
3.653311631966735*^9, 3.653311633467943*^9}, {3.653316338507403*^9,
3.6533164885823174`*^9}, {3.65331705725049*^9, 3.6533171269062853`*^9}, {
3.6533171956625147`*^9, 3.653317227597948*^9}, {3.653317583038548*^9,
3.653317583972519*^9}, {3.653317649647999*^9, 3.653317649748551*^9}, {
3.6533186000816708`*^9, 3.653318771029479*^9}, {3.65331892637752*^9,
3.653318926518014*^9}, {3.653405172941366*^9, 3.6534051733391943`*^9}, {
3.653405618565604*^9, 3.6534056270769777`*^9}, {3.653405668167589*^9,
3.653405668245631*^9}, {3.653405804691223*^9, 3.653405833377026*^9}, {
3.65340588327669*^9, 3.653405884042091*^9}, {3.653405984502988*^9,
3.653406145103266*^9}, {3.654518914833681*^9, 3.654518915720541*^9}, {
3.6545208030995207`*^9, 3.6545208605548897`*^9}, {3.6545209308860807`*^9,
3.654520948243857*^9}, {3.654521047976737*^9, 3.6545210692792673`*^9}, {
3.65452112232196*^9, 3.654521122655486*^9}, {3.655755194724586*^9,
3.655755247324939*^9}, {3.65575528996673*^9, 3.655755291412578*^9}, {
3.655755329909336*^9, 3.655755329973114*^9}, {3.655755616107629*^9,
3.655755672515812*^9}, {3.655755707990672*^9, 3.6557557080448103`*^9}, {
3.655755763672276*^9, 3.655755784782153*^9}, {3.657200072416317*^9,
3.657200073569159*^9}, {3.657201022255227*^9, 3.657201023666459*^9},
3.657201118074176*^9, {3.65720116889391*^9, 3.6572011697577753`*^9}, {
3.6572012306778927`*^9, 3.6572012309852343`*^9}, {3.6572018356095667`*^9,
3.657201835922875*^9}, {3.657201941779063*^9, 3.6572019570475607`*^9}, {
3.6573263395206327`*^9, 3.657326363857086*^9}, {3.65732642181056*^9,
3.657326425634179*^9}, {3.657375701869852*^9, 3.657375715875658*^9}, {
3.6573770570786953`*^9, 3.657377105087933*^9}, {3.657631990215852*^9,
3.657632075267915*^9}, {3.6576321092186537`*^9, 3.6576321129488153`*^9}, {
3.657632219893179*^9, 3.657632221948015*^9}, {3.657632308894751*^9,
3.657632310756009*^9}, {3.65763241044298*^9, 3.6576324481533117`*^9}, {
3.657632552848991*^9, 3.65763262322254*^9}, {3.6576326579976*^9,
3.657632700328822*^9}, {3.657632757684988*^9, 3.657632792181724*^9}, {
3.657632848472783*^9, 3.657632993745557*^9}, {3.657633204055963*^9,
3.657633322496023*^9}, {3.657633363267015*^9, 3.65763336528915*^9}, {
3.6576333987000713`*^9, 3.657633412122054*^9}, {3.6576334574132833`*^9,
3.657633541028365*^9}, {3.657633647224779*^9, 3.65763365495891*^9}, {
3.657634032782339*^9, 3.657634033790275*^9}, {3.65763422345969*^9,
3.6576342282674913`*^9}, {3.657634358198288*^9, 3.657634359508192*^9},
3.657634622044037*^9, {3.658230094192687*^9, 3.658230170752303*^9}, {
3.658230273562339*^9, 3.658230273786837*^9}, {3.658232062399374*^9,
3.658232077063816*^9}, {3.6582321707452593`*^9, 3.658232171607916*^9}, {
3.658232676218773*^9, 3.658232800628454*^9}, {3.658506111783059*^9,
3.6585061864549513`*^9}, {3.658506476871106*^9, 3.65850647831612*^9}, {
3.658506592408903*^9, 3.65850659693468*^9}, {3.658506750596529*^9,
3.65850675141868*^9}, {3.658506977999249*^9, 3.658507004160763*^9}, {
3.658508534429098*^9, 3.658508538118112*^9}, {3.658508644857568*^9,
3.658508664697771*^9}, {3.6585089121430883`*^9, 3.658508943237472*^9}, {
3.6585092172691717`*^9, 3.658509218354616*^9}, {3.658509318407297*^9,
3.658509318444787*^9}, {3.658509454442075*^9, 3.658509455887313*^9}, {
3.6641127856747704`*^9, 3.66411280135459*^9}, {3.664112850220551*^9,
3.66411285034021*^9}, {3.6641141833503857`*^9, 3.664114190043103*^9}, {
3.66411424860785*^9, 3.664114263685442*^9}, {3.66411449181011*^9,
3.664114491871812*^9}, {3.6641176634515257`*^9, 3.66411766622668*^9}, {
3.6642186299444942`*^9, 3.664218631671126*^9}, {3.664221393813716*^9,
3.6642213998776703`*^9}, {3.6642224317650757`*^9, 3.664222432907764*^9}, {
3.664226007548221*^9, 3.66422603250863*^9}, {3.664226077224358*^9,
3.664226154127267*^9}, {3.664278081044779*^9, 3.6642781280002403`*^9}, {
3.664278180790661*^9, 3.664278182126803*^9}, {3.664278350482855*^9,
3.664278377801635*^9}, {3.664278475477022*^9, 3.664278475570146*^9}, {
3.664553154183105*^9, 3.6645531579195213`*^9}, {3.664553209666206*^9,
3.664553209735475*^9}, {3.66455325504218*^9, 3.6645532592022057`*^9}, {
3.664553584505393*^9, 3.66455358500663*^9}, {3.664553808573675*^9,
3.664553808795163*^9}, {3.6647409097889833`*^9, 3.664740975356249*^9}, {
3.665083025836418*^9, 3.665083103311146*^9}, {3.665083144766101*^9,
3.665083151766548*^9}, {3.665083182649922*^9, 3.6650832113095016`*^9}, {
3.665083321562745*^9, 3.6650834833638353`*^9}, {3.665083539316098*^9,
3.665083553097898*^9}, {3.665083611252768*^9, 3.6650836155012283`*^9}, {
3.665083679573867*^9, 3.6650836907291327`*^9}, {3.665083726817916*^9,
3.6650837568885393`*^9}, {3.665083814122416*^9, 3.665083814310657*^9}, {
3.665247498742773*^9, 3.665247593358732*^9}, {3.6652476324253283`*^9,
3.665247640679324*^9}, {3.6665317332965517`*^9, 3.666531821273624*^9},
3.666532225700058*^9, {3.666532399406266*^9, 3.6665324129824047`*^9}, {
3.6665327665588818`*^9, 3.666532772900305*^9}, {3.666532806871456*^9,
3.666532806996879*^9}}]
}, Open ]],
Cell[CellGroupData[{
Cell["Define ingredient functions", "Section",
CellChangeTimes->{{3.637944423939974*^9, 3.637944429147876*^9}, {
3.637944538470634*^9, 3.6379445394060097`*^9}, 3.647026651333486*^9,
3.6470267790957203`*^9}],
Cell[BoxData[{
RowBox[{
RowBox[{
RowBox[{
RowBox[{
RowBox[{"\[Alpha]", "[",
RowBox[{"\[Sigma]i_", ",", "\[Sigma]j_", ",", "\[Omega]_"}], "]"}], "[",
RowBox[{"\[Mu]i_", ",", "\[Mu]j_"}], "]"}], ":=",
RowBox[{"\[Omega]", "/",
RowBox[{"(",
RowBox[{
RowBox[{"E", "^",
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{"\[Mu]i", "-", "\[Mu]j"}], ")"}], "^", "2"}], "/",
RowBox[{"(",
RowBox[{
RowBox[{"2", "*",
RowBox[{"(",
RowBox[{
RowBox[{"\[Sigma]i", "^", "2"}], "+",
RowBox[{"\[Sigma]j", "^", "2"}]}], ")"}]}], "+",
RowBox[{"\[Omega]", "^", "2"}]}], ")"}]}], ")"}]}], "*",
RowBox[{"Sqrt", "[",
RowBox[{
RowBox[{"2", "*",
RowBox[{"\[Sigma]i", "^", "2"}]}], "+",
RowBox[{"2", "*",
RowBox[{"\[Sigma]j", "^", "2"}]}], "+",
RowBox[{"\[Omega]", "^", "2"}]}], "]"}]}], ")"}]}]}], ";"}], " ",
RowBox[{"(*", " ",
RowBox[{
"Competitive", " ", "effect", " ", "of", " ", "species", " ", "j", " ",
"on", " ", "species", " ", "i"}], "*)"}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{
RowBox[{
RowBox[{"\[Beta]", "[",
RowBox[{"\[Sigma]i_", ",", "\[Sigma]j_", ",", "\[Omega]_"}], "]"}], "[",
RowBox[{"\[Mu]i_", ",", "\[Mu]j_"}], "]"}], ":=",
RowBox[{
RowBox[{"(",
RowBox[{"2", "*",
RowBox[{"(",
RowBox[{"\[Mu]j", "-", "\[Mu]i"}], ")"}], "*",
RowBox[{"\[Sigma]i", "^", "2"}], "*", "\[Omega]"}], ")"}], "/",
RowBox[{"(",
RowBox[{
RowBox[{"E", "^",
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{"\[Mu]i", "-", "\[Mu]j"}], ")"}], "^", "2"}], "/",
RowBox[{"(",
RowBox[{
RowBox[{"2", "*",
RowBox[{"(",
RowBox[{
RowBox[{"\[Sigma]i", "^", "2"}], "+",
RowBox[{"\[Sigma]j", "^", "2"}]}], ")"}]}], "+",
RowBox[{"\[Omega]", "^", "2"}]}], ")"}]}], ")"}]}], "*",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"2", "*",
RowBox[{"\[Sigma]i", "^", "2"}]}], "+",
RowBox[{"2", "*",
RowBox[{"\[Sigma]j", "^", "2"}]}], "+",
RowBox[{"\[Omega]", "^", "2"}]}], ")"}], "^",
RowBox[{"(",
RowBox[{"3", "/", "2"}], ")"}]}]}], ")"}]}]}], ";"}], " ",
RowBox[{"(*", " ",
RowBox[{
"Selective", " ", "pressure", " ", "exerted", " ", "by", " ", "species",
" ", "j", " ", "on", " ", "species", " ", "i"}],
"*)"}]}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"If", "[",
RowBox[{
RowBox[{"bshape", "\[Equal]", "1"}], ",", " ",
RowBox[{"(*", " ",
RowBox[{"Rectangular", " ", "growth", " ", "function"}], " ", "*)"}],
"\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"g", "[",
RowBox[{"z_", ",", "\[Theta]_"}], "]"}], ":=",
RowBox[{"Piecewise", "[",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"1", ",",
RowBox[{
RowBox[{"-", "\[Theta]"}], "\[LessEqual]", "z", "\[LessEqual]",
"\[Theta]"}]}], "}"}], ",",
RowBox[{"{",
RowBox[{"0", ",", "Default"}], "}"}]}], "}"}], "]"}]}], ";",
"\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"b", "[",
RowBox[{"\[Sigma]_", ",", "\[Theta]_"}], "]"}], "[", "\[Mu]_", "]"}],
":=",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"Erf", "[",
RowBox[{
RowBox[{"(",
RowBox[{"\[Theta]", "-", "\[Mu]"}], ")"}], "/",
RowBox[{"(",
RowBox[{
RowBox[{"Sqrt", "[", "2", "]"}], "*", "\[Sigma]"}], ")"}]}],
"]"}], "+",
RowBox[{"Erf", "[",
RowBox[{
RowBox[{"(",
RowBox[{"\[Theta]", "+", "\[Mu]"}], ")"}], "/",
RowBox[{"(",
RowBox[{
RowBox[{"Sqrt", "[", "2", "]"}], "*", "\[Sigma]"}], ")"}]}],
"]"}]}], ")"}], "/", "2"}]}], ";", "\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"bbar", "[",
RowBox[{"\[Sigma]_", ",", "\[Theta]_"}], "]"}], "[", "\[Mu]_", "]"}],
":=",
RowBox[{"-",
RowBox[{"(",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"-", "1"}], "+",
RowBox[{"E", "^",
RowBox[{"(",
RowBox[{
RowBox[{"(",
RowBox[{"2", "*", "\[Theta]", "*", "\[Mu]"}], ")"}], "/",
RowBox[{"\[Sigma]", "^", "2"}]}], ")"}]}]}], ")"}], "*",
"\[Sigma]"}], ")"}], "/",
RowBox[{"(",
RowBox[{
RowBox[{"E", "^",
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{"\[Theta]", "+", "\[Mu]"}], ")"}], "^", "2"}], "/",
RowBox[{"(",
RowBox[{"2", "*",
RowBox[{"\[Sigma]", "^", "2"}]}], ")"}]}], ")"}]}], "*",
RowBox[{"Sqrt", "[",
RowBox[{"2", "*", "Pi"}], "]"}]}], ")"}]}], ")"}]}]}], ";",
"\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"bhat", "[",
RowBox[{"\[Sigma]_", ",", "\[Theta]_"}], "]"}], "[", "\[Mu]_", "]"}],
":=",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"-",
RowBox[{"(",
RowBox[{
RowBox[{"E", "^",
RowBox[{"(",
RowBox[{
RowBox[{"(",
RowBox[{"2", "*", "\[Theta]", "*", "\[Mu]"}], ")"}], "/",
RowBox[{"\[Sigma]", "^", "2"}]}], ")"}]}], "*",
RowBox[{"(",
RowBox[{"\[Theta]", "-", "\[Mu]"}], ")"}], "*", "\[Sigma]"}],
")"}]}], "-",
RowBox[{
RowBox[{"(",
RowBox[{"\[Theta]", "+", "\[Mu]"}], ")"}], "*", "\[Sigma]"}]}],
")"}], "/",
RowBox[{"(",
RowBox[{
RowBox[{"E", "^",
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{"\[Theta]", "+", "\[Mu]"}], ")"}], "^", "2"}], "/",
RowBox[{"(",
RowBox[{"2", "*",
RowBox[{"\[Sigma]", "^", "2"}]}], ")"}]}], ")"}]}], "*",
RowBox[{"Sqrt", "[",
RowBox[{"2", "*", "Pi"}], "]"}]}], ")"}]}], "+",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"\[Sigma]", "^", "2"}], "*",
RowBox[{"(",
RowBox[{
RowBox[{"Erf", "[",
RowBox[{
RowBox[{"(",
RowBox[{"\[Theta]", "-", "\[Mu]"}], ")"}], "/",
RowBox[{"(",
RowBox[{
RowBox[{"Sqrt", "[", "2", "]"}], "*", "\[Sigma]"}], ")"}]}],
"]"}], "+",
RowBox[{"Erf", "[",
RowBox[{
RowBox[{"(",
RowBox[{"\[Theta]", "+", "\[Mu]"}], ")"}], "/",
RowBox[{"(",
RowBox[{
RowBox[{"Sqrt", "[", "2", "]"}], "*", "\[Sigma]"}], ")"}]}],
"]"}]}], ")"}]}], ")"}], "/", "2"}]}]}], ";"}]}],
"\[IndentingNewLine]", "]"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"If", "[",
RowBox[{
RowBox[{"bshape", "\[Equal]", "2"}], ",", " ",
RowBox[{"(*", " ",
RowBox[{"Quadratic", " ", "growth", " ", "function"}], " ", "*)"}],
"\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"g", "[",
RowBox[{"z_", ",", "\[Theta]_"}], "]"}], ":=",
RowBox[{"Piecewise", "[",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"1", "-",
RowBox[{
RowBox[{"z", "^", "2"}], "/",
RowBox[{"\[Theta]", "^", "2"}]}]}], ",",
RowBox[{
RowBox[{"-", "\[Theta]"}], "\[LessEqual]", "z", "\[LessEqual]",
"\[Theta]"}]}], "}"}], ",",
RowBox[{"{",
RowBox[{"0", ",", "Default"}], "}"}]}], "}"}], "]"}]}], ";",
"\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"b", "[",
RowBox[{"\[Sigma]_", ",", "\[Theta]_"}], "]"}], "[", "\[Mu]_", "]"}],
":=",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{"E", "^",
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{"\[Theta]", "-", "\[Mu]"}], ")"}], "^", "2"}], "/",
RowBox[{"(",
RowBox[{"2", "*",
RowBox[{"\[Sigma]", "^", "2"}]}], ")"}]}], ")"}]}], "*",
RowBox[{"Sqrt", "[",
RowBox[{"2", "/", "Pi"}], "]"}], "*",
RowBox[{"(",
RowBox[{"\[Theta]", "-", "\[Mu]", "+",
RowBox[{
RowBox[{"E", "^",
RowBox[{"(",
RowBox[{
RowBox[{"(",
RowBox[{"2", "*", "\[Theta]", "*", "\[Mu]"}], ")"}], "/",
RowBox[{"\[Sigma]", "^", "2"}]}], ")"}]}], "*",
RowBox[{"(",
RowBox[{"\[Theta]", "+", "\[Mu]"}], ")"}]}]}], ")"}], "*",
"\[Sigma]"}], "+",
RowBox[{
RowBox[{"E", "^",
RowBox[{"(",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"\[Theta]", "^", "2"}], "+",
RowBox[{"\[Mu]", "^", "2"}]}], ")"}], "/",
RowBox[{"\[Sigma]", "^", "2"}]}], ")"}]}], "*",
RowBox[{"(",
RowBox[{
RowBox[{"\[Theta]", "^", "2"}], "-",
RowBox[{"\[Mu]", "^", "2"}], "-",
RowBox[{"\[Sigma]", "^", "2"}]}], ")"}], "*",
RowBox[{"(",
RowBox[{
RowBox[{"Erf", "[",
RowBox[{
RowBox[{"(",
RowBox[{"\[Theta]", "-", "\[Mu]"}], ")"}], "/",
RowBox[{"(",
RowBox[{
RowBox[{"Sqrt", "[", "2", "]"}], "*", "\[Sigma]"}], ")"}]}],
"]"}], "+",
RowBox[{"Erf", "[",
RowBox[{
RowBox[{"(",
RowBox[{"\[Theta]", "+", "\[Mu]"}], ")"}], "/",
RowBox[{"(",
RowBox[{
RowBox[{"Sqrt", "[", "2", "]"}], "*", "\[Sigma]"}], ")"}]}],
"]"}]}], ")"}]}]}], ")"}], "/",
RowBox[{"(",
RowBox[{"2", "*",
RowBox[{"E", "^",
RowBox[{"(",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"\[Theta]", "^", "2"}], "+",
RowBox[{"\[Mu]", "^", "2"}]}], ")"}], "/",
RowBox[{"\[Sigma]", "^", "2"}]}], ")"}]}], "*",
RowBox[{"\[Theta]", "^", "2"}]}], ")"}]}]}], ";",
"\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"bbar", "[",
RowBox[{"\[Sigma]_", ",", "\[Theta]_"}], "]"}], "[", "\[Mu]_", "]"}],
":=",
RowBox[{"-",
RowBox[{"(",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"\[Sigma]", "^", "2"}], "*",
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"E", "^",
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{"\[Theta]", "-", "\[Mu]"}], ")"}], "^", "2"}],
"/",
RowBox[{"(",
RowBox[{"2", "*",
RowBox[{"\[Sigma]", "^", "2"}]}], ")"}]}], ")"}]}], "-",
RowBox[{"E", "^",
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{"\[Theta]", "+", "\[Mu]"}], ")"}], "^", "2"}],
"/",
RowBox[{"(",
RowBox[{"2", "*",
RowBox[{"\[Sigma]", "^", "2"}]}], ")"}]}], ")"}]}]}],
")"}], "*",
RowBox[{"Sqrt", "[",
RowBox[{"2", "/", "Pi"}], "]"}], "*", "\[Sigma]"}], "+",
RowBox[{
RowBox[{"E", "^",
RowBox[{"(",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"\[Theta]", "^", "2"}], "+",
RowBox[{"\[Mu]", "^", "2"}]}], ")"}], "/",
RowBox[{"\[Sigma]", "^", "2"}]}], ")"}]}], "*", "\[Mu]", "*",
RowBox[{"(",
RowBox[{
RowBox[{"Erf", "[",
RowBox[{
RowBox[{"(",
RowBox[{"\[Theta]", "-", "\[Mu]"}], ")"}], "/",
RowBox[{"(",
RowBox[{
RowBox[{"Sqrt", "[", "2", "]"}], "*", "\[Sigma]"}],
")"}]}], "]"}], "+",
RowBox[{"Erf", "[",
RowBox[{
RowBox[{"(",
RowBox[{"\[Theta]", "+", "\[Mu]"}], ")"}], "/",
RowBox[{"(",
RowBox[{
RowBox[{"Sqrt", "[", "2", "]"}], "*", "\[Sigma]"}],
")"}]}], "]"}]}], ")"}]}]}], ")"}]}], ")"}], "/",
RowBox[{"(",
RowBox[{
RowBox[{"E", "^",
RowBox[{"(",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"\[Theta]", "^", "2"}], "+",
RowBox[{"\[Mu]", "^", "2"}]}], ")"}], "/",
RowBox[{"\[Sigma]", "^", "2"}]}], ")"}]}], "*",
RowBox[{"\[Theta]", "^", "2"}]}], ")"}]}], ")"}]}]}], ";",
"\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"bhat", "[",
RowBox[{"\[Sigma]_", ",", "\[Theta]_"}], "]"}], "[", "\[Mu]_", "]"}],
":=",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"\[Sigma]", "^", "2"}], "*",
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"Sqrt", "[",
RowBox[{"2", "/", "Pi"}], "]"}], "*",
RowBox[{"(",
RowBox[{
RowBox[{"3", "*", "\[Theta]"}], "-", "\[Mu]", "+",
RowBox[{
RowBox[{"E", "^",
RowBox[{"(",
RowBox[{
RowBox[{"(",
RowBox[{"2", "*", "\[Theta]", "*", "\[Mu]"}], ")"}], "/",
RowBox[{"\[Sigma]", "^", "2"}]}], ")"}]}], "*",
RowBox[{"(",
RowBox[{
RowBox[{"3", "*", "\[Theta]"}], "+", "\[Mu]"}], ")"}]}]}],
")"}], "*", "\[Sigma]"}], ")"}], "/",
RowBox[{"E", "^",
RowBox[{"(",
RowBox[{
RowBox[{
RowBox[{"(",
RowBox[{"\[Theta]", "+", "\[Mu]"}], ")"}], "^", "2"}], "/",
RowBox[{"(",
RowBox[{"2", "*",
RowBox[{"\[Sigma]", "^", "2"}]}], ")"}]}], ")"}]}]}], "+",
RowBox[{
RowBox[{"(",
RowBox[{
RowBox[{"\[Theta]", "^", "2"}], "-",
RowBox[{"\[Mu]", "^", "2"}], "-",
RowBox[{"3", "*",
RowBox[{"\[Sigma]", "^", "2"}]}]}], ")"}], "*",
RowBox[{"(",
RowBox[{
RowBox[{"Erf", "[",
RowBox[{
RowBox[{"(",
RowBox[{"\[Theta]", "-", "\[Mu]"}], ")"}], "/",
RowBox[{"(",
RowBox[{
RowBox[{"Sqrt", "[", "2", "]"}], "*", "\[Sigma]"}], ")"}]}],
"]"}], "+",
RowBox[{"Erf", "[",
RowBox[{
RowBox[{"(",
RowBox[{"\[Theta]", "+", "\[Mu]"}], ")"}], "/",
RowBox[{"(",
RowBox[{
RowBox[{"Sqrt", "[", "2", "]"}], "*", "\[Sigma]"}], ")"}]}],
"]"}]}], ")"}]}]}], ")"}]}], ")"}], "/",
RowBox[{"(",
RowBox[{"2", "*",
RowBox[{"\[Theta]", "^", "2"}]}], ")"}]}]}], ";"}]}],
"\[IndentingNewLine]", "]"}], ";"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"If", "[",
RowBox[{
RowBox[{"bshape", "\[Equal]", "3"}], ",", " ",
RowBox[{"(*", " ",
RowBox[{"Triangular", " ", "growth", " ", "function"}], " ", "*)"}],
"\[IndentingNewLine]",
RowBox[{
RowBox[{
RowBox[{"g", "[",
RowBox[{"z_", ",", "\[Theta]_"}], "]"}], ":=",
RowBox[{"Piecewise", "[",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{