-
Notifications
You must be signed in to change notification settings - Fork 0
/
AModelOfPlasmodiumFalciparumPopulationDynamicsInAPatientDuri-source.nb
2240 lines (2199 loc) · 99.6 KB
/
AModelOfPlasmodiumFalciparumPopulationDynamicsInAPatientDuri-source.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 8.0' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 157, 7]
NotebookDataLength[ 99554, 2230]
NotebookOptionsPosition[ 98013, 2177]
NotebookOutlinePosition[ 98736, 2203]
CellTagsIndexPosition[ 98693, 2200]
WindowTitle->A Model of Plasmodium Falciparum Population Dynamics in a \
Patient during Treatment with Artesunate - Source
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[CellGroupData[{
Cell[TextData[{
"A Model of ",
StyleBox["Plasmodium Falciparum",
FontSlant->"Italic"],
" Population Dynamics in a Patient during Treatment with Artesunate"
}], "Section",
CellFrame->{{0, 0}, {0, 0}},
ShowCellBracket->False,
FontColor->RGBColor[0.597406, 0, 0.0527047]],
Cell[BoxData[
GraphicsBox[RasterBox[CompressedData["
1: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
FP/69esnAAAAAAAAAAAAwM74B4thROM=
"], {{0, 0}, {1800, 25}}, {0, 255},
ColorFunction->RGBColor],
ImageSize->{1800, 25},
PlotRange->{{0, 1800}, {0, 25}}]], "Section",
CellFrame->{{0, 0}, {0, 0}},
ShowCellBracket->False],
Cell[BoxData[
RowBox[{"Manipulate", "[", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Column", "[",
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{
RowBox[{"ParaDist", "[",
RowBox[{"initN", ",", "48", ",", "\[Mu]", ",", "\[Sigma]"}], "]"}],
",", "\[IndentingNewLine]",
RowBox[{"DHAGraph", "[",
RowBox[{"xm", ",", "ym", ",", "a", ",", "ke"}], "]"}], ",",
"\[IndentingNewLine]",
RowBox[{"ParaGraph", "[",
RowBox[{
"initN", ",", "PMR", ",", "\[Mu]", ",", "\[Sigma]", ",", "48", ",",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"KZRB", ",", "KZRE"}], "}"}], ",",
RowBox[{"{",
RowBox[{
RowBox[{"KZRE", "+", "1"}], ",", "KZTE"}], "}"}], ",",
RowBox[{"{",
RowBox[{
RowBox[{"KZTE", "+", "1"}], ",", "KZSE"}], "}"}]}], "}"}], ",",
RowBox[{"{",
RowBox[{"xm", ",", "ym", ",", "a", ",", "ke"}], "}"}], ",", "everyH",
",", "Ndrug", ",",
RowBox[{"{",
RowBox[{"\[Gamma]R", ",", "\[Gamma]T", ",", "\[Gamma]S"}], "}"}],
",",
RowBox[{"{",
RowBox[{"ec50R", ",", "ec50T", ",", "ec50S"}], "}"}], ",",
RowBox[{"{",
RowBox[{"0.0", ",", "0.0", ",", "0.0"}], "}"}], ",",
RowBox[{"{",
RowBox[{"emaxR", ",", "emaxT", ",", "emaxS"}], "}"}], ",", "T", ",",
"120"}], "]"}]}], "\[IndentingNewLine]", "}"}], "]"}], ",",
"\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"ctrl", ",", "1", ",", "\"\<\>\""}], "}"}], ",",
RowBox[{"{",
RowBox[{
RowBox[{"1", "\[Rule]", "\"\<parasite distribution\>\""}], ",",
RowBox[{"2", "\[Rule]", "\"\<dose regimen\>\""}], ",",
RowBox[{"3", "\[Rule]", "\"\<DHA concentration\>\""}], ",",
RowBox[{"4", "\[Rule]", "\"\<kill zones\>\""}], ",",
RowBox[{"5", "\[Rule]", "\"\<killing effect\>\""}]}], "}"}], ",",
RowBox[{"ControlPlacement", "\[Rule]", "Top"}]}], "}"}], ",",
"\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{"PaneSelector", "[",
RowBox[{
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{
RowBox[{"1", "\[Rule]", " ",
RowBox[{"Column", "[",
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Style", "[",
RowBox[{
"\"\<Parasite distribution on admission\>\"", ",", "Bold"}],
"]"}], ",", "\[IndentingNewLine]",
"\"\<initial number of parasites\>\"", ",",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"initN", ",",
RowBox[{"2.8", "*",
RowBox[{"10", "^", "11"}]}], ",", "\"\<\>\""}], "}"}], ",",
RowBox[{"1.", "*",
RowBox[{"10", "^", "11"}]}], ",",
RowBox[{"10", "^", "12"}], ",",
RowBox[{"0.5", "*",
RowBox[{"10", "^", "11"}]}], ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}], ",",
"\[IndentingNewLine]",
"\"\<parasite multiplication rate (/48 hours)\>\"", ",",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"PMR", ",", "7", ",", "\"\<\>\""}], "}"}], ",", "6",
",", "32", ",", "1", ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}], ",",
"\[IndentingNewLine]", "\"\<mean age of parasite (hours)\>\"", ",",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"\[Mu]", ",", "10", ",", "\"\<\>\""}], "}"}], ",", "1",
",", "48", ",", "1", ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}], ",",
"\[IndentingNewLine]",
"\"\<standard deviation of parasite ages (hours)\>\"", ",",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"\[Sigma]", ",", "4", ",", "\"\<\>\""}], "}"}], ",",
"1", ",", "50", ",", "1", ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}]}], "}"}],
"]"}]}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{"2", "\[Rule]", " ",
RowBox[{"Column", "[",
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Style", "[",
RowBox[{"\"\<Dose regimen\>\"", ",", "Bold"}], "]"}], ",",
"\[IndentingNewLine]", "\"\<number of doses\>\"", ",",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"Ndrug", ",", "7", ",", "\"\<\>\""}], "}"}], ",", "1",
",", "24", ",", "1", ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}], ",",
"\[IndentingNewLine]", "\"\<dosing interval (hours)\>\"", ",",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"everyH", ",", "24", ",", "\"\<\>\""}], "}"}], ",",
"1", ",", "48", ",", "1", ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}]}], "}"}],
"]"}]}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{"3", "\[Rule]", " ",
RowBox[{"Column", "[",
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Style", "[",
RowBox[{
"\"\<DHA concentration profile (for each dose)\>\"", ",",
"Bold"}], "]"}], ",", "\[IndentingNewLine]",
"\"\<time at max concentration (hours)\>\"", ",",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"xm", ",", "2", ",", "\"\<\>\""}], "}"}], ",", "1",
",", "20", ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}], ",",
"\[IndentingNewLine]", "\"\<max concentration (ng/ml)\>\"", ",",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"ym", ",", "1000", ",", "\"\<\>\""}], "}"}], ",",
"0.5", ",", "2000.", ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}], ",",
"\[IndentingNewLine]", "\"\<elimination rate (/hours)\>\"", ",",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"ke", ",", "0.5", ",", "\"\<\>\""}], "}"}], ",",
"0.001", ",", "10", ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}]}], "}"}],
"]"}]}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{"4", "\[Rule]", " ",
RowBox[{"Column", "[",
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Style", "[",
RowBox[{"\"\<Kill zones (sensitive ages) \>\"", ",", "Bold"}],
"]"}], ",", "\[IndentingNewLine]",
"\"\<ring: begin kill zone (hours)\>\"", ",",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"KZRB", ",", "6", ",", "\"\<\>\""}], "}"}], ",", "1",
",", "96", ",", "1", ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}], ",",
"\[IndentingNewLine]", "\"\<ring: end kill zone (hours)\>\"", ",",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"KZRE", ",", "26", ",", "\"\<\>\""}], "}"}], ",",
"KZRB", ",", "60", ",", "1", ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}], ",",
"\[IndentingNewLine]",
"\"\<trophozoite: end kill zone (hours)\>\"", ",",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"KZTE", ",", "38", ",", "\"\<\>\""}], "}"}], ",",
RowBox[{"KZRE", "+", "1"}], ",", "90", ",", "1", ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}], ",",
"\[IndentingNewLine]", "\"\<schizont: end kill zone (hours)\>\"",
",",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"KZSE", ",", "44", ",", "\"\<\>\""}], "}"}], ",",
RowBox[{"KZTE", "+", "1"}], ",", "100", ",", "1", ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}]}], "}"}],
"]"}]}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{"5", "\[Rule]", " ",
RowBox[{"Column", "[",
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Style", "[",
RowBox[{"\"\<Killing effect parameters\>\"", ",", "Bold"}], "]"}],
",", "\[IndentingNewLine]",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"\[Gamma]R", ",", "6.5"}], "}"}], ",", "0.5", ",",
"10", ",", "0.001", ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}], ",",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"\[Gamma]T", ",", "6.5"}], "}"}], ",", "0.5", ",",
"10", ",", "0.001", ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}], ",",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"\[Gamma]S", ",", "6.5"}], "}"}], ",", "0.5", ",",
"10", ",", "0.001", ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}], ",",
"\[IndentingNewLine]", "\"\<EC50 ring (ng/ml)\>\"", ",",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"ec50R", ",", "20.5", ",", "\"\<\>\""}], "}"}], ",",
"0.001", ",", "100", ",", "0.001", ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}], ",",
"\[IndentingNewLine]", "\"\<EC50 trophozoites (ng/ml)\>\"", ",",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"ec50T", ",", "20.5", ",", "\"\<\>\""}], "}"}], ",",
"0.001", ",", "100", ",", "0.001", ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}], ",",
"\[IndentingNewLine]", "\"\<EC50 schizont (ng/ml)\>\"", ",",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"ec50S", ",", "20.5", ",", "\"\<\>\""}], "}"}], ",",
"0.001", ",", "100", ",", "0.001", ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}], ",",
"\[IndentingNewLine]", "\"\<ring: max efficacy (%)\>\"", ",",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"emaxR", ",", "99.99", ",", "\"\<\>\""}], "}"}], ",",
"50", ",", "99.999", ",", "0.001", ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}], ",",
"\[IndentingNewLine]", "\"\<trophozoite: max efficacy (%)\>\"",
",",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"emaxT", ",", "99.99", ",", "\"\<\>\""}], "}"}], ",",
"50", ",", "99.999", ",", "0.001", ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}], ",",
"\[IndentingNewLine]", "\"\<schizont: max efficacy (%)\>\"", ",",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"emaxS", ",", "99.99", ",", "\"\<\>\""}], "}"}], ",",
"50", ",", "99.999", ",", "0.001", ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}], ",",
"\[IndentingNewLine]", "\"\<1/alpha\>\"", ",",
RowBox[{"Control", "@",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"T", ",", "5.", ",", "\"\<\>\""}], "}"}], ",", "1.",
",", "10.", ",", "0.001", ",",
RowBox[{"Appearance", "\[Rule]", "\"\<Labeled\>\""}], ",",
RowBox[{"ImageSize", "\[Rule]", "Tiny"}]}], "}"}]}]}], "}"}],
"]"}]}]}], "}"}], ",", "\[IndentingNewLine]",
RowBox[{"Dynamic", "[", "ctrl", "]"}]}], "\[IndentingNewLine]", "]"}],
",", "\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{"ControlPlacement", "\[Rule]", "Left"}], ",",
RowBox[{"SynchronousInitialization", "\[Rule]", "False"}], ",",
RowBox[{"ContinuousAction", "\[Rule]", "False"}], ",",
RowBox[{"AutorunSequencing", "\[Rule]", " ",
RowBox[{"{",
RowBox[{"1", ",", "2"}], "}"}]}], ",", "\[IndentingNewLine]",
RowBox[{"Initialization", "\[RuleDelayed]",
RowBox[{"{", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Get", "[", "\"\<PlotLegends`\>\"", "]"}], ";",
"\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{"(*", " ",
RowBox[{"concentration", " ", "of", " ", "DHA"}], " ", "*)"}],
"\[IndentingNewLine]",
RowBox[{
RowBox[{"genpoints", "[",
RowBox[{"xm_", ",", "ym_", ",", "ke_", ",", "x_"}], "]"}], ":=",
RowBox[{"Piecewise", "[",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"ym", "-",
RowBox[{
RowBox[{"(",
RowBox[{"ym", "/", "xm"}], ")"}], "*",
RowBox[{"(",
RowBox[{"xm", "-", "x"}], ")"}]}]}], ",",
RowBox[{"x", "\[LessEqual]", " ", "xm"}]}], "}"}], ",",
RowBox[{"{",
RowBox[{
RowBox[{"ym", "*",
RowBox[{"Exp", "[",
RowBox[{
RowBox[{"-", "ke"}], "*",
RowBox[{"(",
RowBox[{"x", "-", "xm"}], ")"}]}], "]"}]}], ",",
RowBox[{"x", ">", " ", "xm"}]}], "}"}]}], "}"}], "]"}]}], ";",
"\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
"calculate", " ", "the", " ", "drug", " ", "concentration", " ", "and",
" ", "drug", " ", "efficacy", " ", "of", " ", "each", " ",
"parasite", " ", "stage",
RowBox[{"(",
RowBox[{"Ring", ",",
RowBox[{"Trophozoite", " ", "and", " ", "Schizont"}]}], ")"}]}],
"*)"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"ConcMod", "[",
RowBox[{
"xm_", ",", "ym_", ",", "a_", ",", "ke_", ",", "everyH_Integer", ",",
"Ndrug_Integer", ",", "gamma_List", ",", "ec50_List", ",",
"emin_List", ",", "emax_List"}], "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{"i", ",",
RowBox[{"j", "=", "0"}], ",",
RowBox[{"nd", "=", "1"}], ",", "dat", ",", "maxpoint", ",",
"part1", ",", "part2", ",", "fitke", ",", "modka", ",", "modke",
",", "fn", ",", "x", ",", "endtime", ",", "t", ",",
RowBox[{"conc", "=", "0"}], ",",
RowBox[{"concls", "=",
RowBox[{"{", "}"}]}], ",",
RowBox[{"TIMEMAX", "=", "1000"}]}], "}"}], ",",
"\[IndentingNewLine]",
RowBox[{
RowBox[{"For", "[",
RowBox[{
RowBox[{"i", "=", "0"}], ",",
RowBox[{"i", "<",
RowBox[{"Ndrug", "*", "everyH"}]}], ",",
RowBox[{"i", "=",
RowBox[{"i", "+", "1"}]}], ",",
RowBox[{
RowBox[{"If", "[",
RowBox[{
RowBox[{"j", "\[NotEqual]", "everyH"}], ",",
RowBox[{
RowBox[{"conc", "=",
RowBox[{
RowBox[{"genpoints", "[",
RowBox[{"xm", ",", "ym", ",", "ke", ",", "x"}], "]"}], "/.",
RowBox[{"x", "\[Rule]", "j"}]}]}], ";",
"\[IndentingNewLine]",
RowBox[{"AppendTo", "[",
RowBox[{"concls", ",",
RowBox[{"{",
RowBox[{"i", ",", "conc", ",",
RowBox[{"Eff", "[",
RowBox[{"conc", ",",
RowBox[{"gamma", "[",
RowBox[{"[", "1", "]"}], "]"}], ",",
RowBox[{"ec50", "[",
RowBox[{"[", "1", "]"}], "]"}], ",",
RowBox[{"emin", "[",
RowBox[{"[", "1", "]"}], "]"}], ",",
RowBox[{"emax", "[",
RowBox[{"[", "1", "]"}], "]"}]}], "]"}], ",",
RowBox[{"Eff", "[",
RowBox[{"conc", ",",
RowBox[{"gamma", "[",
RowBox[{"[", "2", "]"}], "]"}], ",",
RowBox[{"ec50", "[",
RowBox[{"[", "2", "]"}], "]"}], ",",
RowBox[{"emin", "[",
RowBox[{"[", "2", "]"}], "]"}], ",",
RowBox[{"emax", "[",
RowBox[{"[", "2", "]"}], "]"}]}], "]"}], ",",
RowBox[{"Eff", "[",
RowBox[{"conc", ",",
RowBox[{"gamma", "[",
RowBox[{"[", "3", "]"}], "]"}], ",",
RowBox[{"ec50", "[",
RowBox[{"[", "3", "]"}], "]"}], ",",
RowBox[{"emin", "[",
RowBox[{"[", "3", "]"}], "]"}], ",",
RowBox[{"emax", "[",
RowBox[{"[", "3", "]"}], "]"}]}], "]"}]}], "}"}]}], "]"}],
";"}]}], "\[IndentingNewLine]", "]"}], ";",
"\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"j", "\[Equal]", "everyH"}], "&&",
RowBox[{"nd", "<", "Ndrug"}]}], ",",
RowBox[{
RowBox[{"nd", "=",
RowBox[{"nd", "+", "1"}]}], ";", "\[IndentingNewLine]",
RowBox[{"conc", "=",
RowBox[{
RowBox[{"conc", "+",
RowBox[{"genpoints", "[",
RowBox[{"xm", ",", "ym", ",", "ke", ",", "x"}], "]"}]}], "/.",
RowBox[{"x", "\[Rule]", "j"}]}]}], ";",
"\[IndentingNewLine]",
RowBox[{"AppendTo", "[",
RowBox[{"concls", ",",
RowBox[{"{",
RowBox[{"i", ",", "conc", ",",
RowBox[{"Eff", "[",
RowBox[{"conc", ",",
RowBox[{"gamma", "[",
RowBox[{"[", "1", "]"}], "]"}], ",",
RowBox[{"ec50", "[",
RowBox[{"[", "1", "]"}], "]"}], ",",
RowBox[{"emin", "[",
RowBox[{"[", "1", "]"}], "]"}], ",",
RowBox[{"emax", "[",
RowBox[{"[", "1", "]"}], "]"}]}], "]"}], ",",
RowBox[{"Eff", "[",
RowBox[{"conc", ",",
RowBox[{"gamma", "[",
RowBox[{"[", "2", "]"}], "]"}], ",",
RowBox[{"ec50", "[",
RowBox[{"[", "2", "]"}], "]"}], ",",
RowBox[{"emin", "[",
RowBox[{"[", "2", "]"}], "]"}], ",",
RowBox[{"emax", "[",
RowBox[{"[", "2", "]"}], "]"}]}], "]"}], ",",
RowBox[{"Eff", "[",
RowBox[{"conc", ",",
RowBox[{"gamma", "[",
RowBox[{"[", "3", "]"}], "]"}], ",",
RowBox[{"ec50", "[",
RowBox[{"[", "3", "]"}], "]"}], ",",
RowBox[{"emin", "[",
RowBox[{"[", "3", "]"}], "]"}], ",",
RowBox[{"emax", "[",
RowBox[{"[", "3", "]"}], "]"}]}], "]"}]}], "}"}]}], "]"}],
";", "\[IndentingNewLine]",
RowBox[{"j", "=", "0"}], ";"}]}], "]"}], ";",
"\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{"update", " ", "ndrug"}], "*)"}], "\[IndentingNewLine]",
RowBox[{"j", "=",
RowBox[{"j", "+", "1"}]}], ";"}]}], "]"}], ";",
"\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{"For", "[",
RowBox[{
RowBox[{
RowBox[{"i", "=",
RowBox[{"Ndrug", "*", "everyH"}]}], ";",
RowBox[{"j", "=", "everyH"}]}], ",",
RowBox[{"i", "\[LessEqual]", "TIMEMAX"}], ",",
RowBox[{"i", "=",
RowBox[{"i", "+", "1"}]}], ",",
RowBox[{
RowBox[{"conc", "=",
RowBox[{
RowBox[{"genpoints", "[",
RowBox[{"xm", ",", "ym", ",", "ke", ",", "x"}], "]"}], "/.",
RowBox[{"x", "\[Rule]", "j"}]}]}], ";", "\[IndentingNewLine]",
RowBox[{"AppendTo", "[",
RowBox[{"concls", ",",
RowBox[{"{",
RowBox[{"i", ",", "conc", ",",
RowBox[{"Eff", "[",
RowBox[{"conc", ",",
RowBox[{"gamma", "[",
RowBox[{"[", "1", "]"}], "]"}], ",",
RowBox[{"ec50", "[",
RowBox[{"[", "1", "]"}], "]"}], ",",
RowBox[{"emin", "[",
RowBox[{"[", "1", "]"}], "]"}], ",",
RowBox[{"emax", "[",
RowBox[{"[", "1", "]"}], "]"}]}], "]"}], ",",
RowBox[{"Eff", "[",
RowBox[{"conc", ",",
RowBox[{"gamma", "[",
RowBox[{"[", "2", "]"}], "]"}], ",",
RowBox[{"ec50", "[",
RowBox[{"[", "2", "]"}], "]"}], ",",
RowBox[{"emin", "[",
RowBox[{"[", "2", "]"}], "]"}], ",",
RowBox[{"emax", "[",
RowBox[{"[", "2", "]"}], "]"}]}], "]"}], ",",
RowBox[{"Eff", "[",
RowBox[{"conc", ",",
RowBox[{"gamma", "[",
RowBox[{"[", "3", "]"}], "]"}], ",",
RowBox[{"ec50", "[",
RowBox[{"[", "3", "]"}], "]"}], ",",
RowBox[{"emin", "[",
RowBox[{"[", "3", "]"}], "]"}], ",",
RowBox[{"emax", "[",
RowBox[{"[", "3", "]"}], "]"}]}], "]"}]}], "}"}]}], "]"}],
";", "\[IndentingNewLine]",
RowBox[{"j", "=",
RowBox[{"j", "+", "1"}]}], ";"}]}], "]"}], ";",
"\[IndentingNewLine]", "concls"}]}], "]"}]}], ";",
"\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{"(*", " ",
RowBox[{
"age", " ", "distribution", " ", "of", " ", "parasites", " ", "on",
" ", "admission"}], " ", "*)"}],
RowBox[{
RowBox[{"DistributeN", "[",
RowBox[{"initN_", ",", "LC_Integer", ",", "mu_", ",", "sigma_"}],
"]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{"distr", ",", "x"}], "}"}], ",",
RowBox[{
RowBox[{"distr", "=",
RowBox[{"Table", "[",
RowBox[{
RowBox[{
RowBox[{"PDF", "[",
RowBox[{
RowBox[{"NormalDistribution", "[",
RowBox[{"mu", ",", "sigma"}], "]"}], ",", "x"}], "]"}], "//",
"N"}], ",",
RowBox[{"{",
RowBox[{"x", ",", "1", ",", "LC"}], "}"}]}], "]"}]}], ";",
"\[IndentingNewLine]",
RowBox[{
RowBox[{"(",
RowBox[{"initN", "/",
RowBox[{"Total", "[", "distr", "]"}]}], ")"}], "*",
"distr"}]}]}], "]"}]}], ";", "\[IndentingNewLine]",
"\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
"shift", " ", "the", " ", "list", " ", "of", " ", "number", " ", "to",
" ", "the", " ", "right", " ", "with", " ", "a", " ",
"multiplication", " ", "pmr"}], "*)"}],
RowBox[{
RowBox[{"Shiftonehour", "[",
RowBox[{"ls_List", ",", "PMR_Integer"}], "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{", "tmp", "}"}], ",",
RowBox[{
RowBox[{"tmp", "=", "ls"}], ";", "\[IndentingNewLine]",
RowBox[{"tmp", "=",
RowBox[{"RotateRight", "[", "tmp", "]"}]}], ";",
"\[IndentingNewLine]",
RowBox[{"tmp", "=",
RowBox[{"ReplacePart", "[",
RowBox[{"tmp", ",",
RowBox[{"1", "\[Rule]",
RowBox[{
RowBox[{"tmp", "[",
RowBox[{"[", "1", "]"}], "]"}], "*", "PMR"}]}]}], "]"}]}],
";", "\[IndentingNewLine]", "tmp"}]}], "]"}]}], ";",
"\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Eff", "[",
RowBox[{
"c_", ",", "gamma_", ",", "ec50_", ",", "emin_", ",", "emax_"}],
"]"}], ":=",
RowBox[{"emin", "+",
RowBox[{
RowBox[{"(",
RowBox[{"emax", "-", "emin"}], ")"}], "*",
RowBox[{
RowBox[{"c", "^", "gamma"}], "/",
RowBox[{"(",
RowBox[{
RowBox[{"c", "^", "gamma"}], "+",
RowBox[{"ec50", "^", "gamma"}]}], ")"}]}]}]}]}], ";",
"\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{
RowBox[{"Ki", "[",
RowBox[{"T_Real", ",", "concls_List"}], "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{"i", ",", "lsk"}], "}"}], ",",
RowBox[{
RowBox[{"lsk", "=",
RowBox[{"Table", "[",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{
RowBox[{"1", "/", "T"}], " ",
RowBox[{"Log", "[",
RowBox[{"100.", "/",
RowBox[{"(",
RowBox[{"100.", "-",
RowBox[{"concls", "[",
RowBox[{"[",
RowBox[{"i", ",", "3"}], "]"}], "]"}]}], ")"}]}], "]"}]}],
",",
RowBox[{
RowBox[{"1", "/", "T"}], " ",
RowBox[{"Log", "[",
RowBox[{"100.", "/",
RowBox[{"(",
RowBox[{"100.", "-",
RowBox[{"concls", "[",
RowBox[{"[",
RowBox[{"i", ",", "4"}], "]"}], "]"}]}], ")"}]}], "]"}]}],
",",
RowBox[{
RowBox[{"1", "/", "T"}], " ",
RowBox[{"Log", "[",
RowBox[{"100.", "/",
RowBox[{"(",
RowBox[{"100.", "-",
RowBox[{"concls", "[",
RowBox[{"[",
RowBox[{"i", ",", "5"}], "]"}], "]"}]}], ")"}]}],
"]"}]}]}], "}"}], ",",
RowBox[{"{",
RowBox[{"i", ",", "1", ",",
RowBox[{"Length", "[", "concls", "]"}]}], "}"}]}], "]"}]}],
";", "\[IndentingNewLine]", "lsk"}]}], "]"}]}], ";",
"\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{"decay", " ", "function"}], "*)"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"Fdecay", "[",
RowBox[{
"ages_", ",", "lst_", ",", "attime_", ",", "lsk_", ",", "stages_"}],
"]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{"tmp", ",", "i"}], "}"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"i", "=", "ages"}], ";", "\[IndentingNewLine]",
RowBox[{"tmp", "=",
RowBox[{"lst", "[",
RowBox[{"[", "i", "]"}], "]"}]}], ";", "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"stages", "[",
RowBox[{"[", "i", "]"}], "]"}], "\[Equal]", "1"}], ",",
RowBox[{"tmp", "=",
RowBox[{
RowBox[{"lst", "[",
RowBox[{"[", "i", "]"}], "]"}], "*",
RowBox[{"Exp", "[",
RowBox[{"-",
RowBox[{"lsk", "[",
RowBox[{"[",
RowBox[{"attime", ",", "1"}], "]"}], "]"}]}], "]"}]}]}]}],
"]"}], ";", "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"stages", "[",
RowBox[{"[", "i", "]"}], "]"}], "\[Equal]", "2"}], ",",
RowBox[{"tmp", "=",
RowBox[{
RowBox[{"lst", "[",
RowBox[{"[", "i", "]"}], "]"}], "*",
RowBox[{"Exp", "[",
RowBox[{"-",
RowBox[{"lsk", "[",
RowBox[{"[",
RowBox[{"attime", ",", "2"}], "]"}], "]"}]}], "]"}]}]}]}],
"]"}], ";", "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"stages", "[",
RowBox[{"[", "i", "]"}], "]"}], "\[Equal]", "3"}], ",",
RowBox[{"tmp", "=",
RowBox[{
RowBox[{"lst", "[",
RowBox[{"[", "i", "]"}], "]"}], "*",
RowBox[{"Exp", "[",
RowBox[{"-",
RowBox[{"lsk", "[",
RowBox[{"[",
RowBox[{"attime", ",", "3"}], "]"}], "]"}]}], "]"}]}]}]}],
"]"}], ";", "\[IndentingNewLine]", "tmp"}]}], "]"}]}], ";",
"\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{
RowBox[{"WhichRTS", "[",
RowBox[{"lst_List", ",", "KZ_List"}], "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{"i", ",", "tmp"}], "}"}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"tmp", "=",
RowBox[{"Table", "[",
RowBox[{"0", ",",
RowBox[{"{",
RowBox[{"Length", "[", "lst", "]"}], "}"}]}], "]"}]}], ";",
"\[IndentingNewLine]",
RowBox[{"For", "[",
RowBox[{
RowBox[{"i", "=", "1"}], ",",
RowBox[{"i", "\[LessEqual]",
RowBox[{"Length", "[", "lst", "]"}]}], ",",
RowBox[{"i", "=",
RowBox[{"i", "+", "1"}]}], ",",
RowBox[{
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"IntervalMemberQ", "[",
RowBox[{
RowBox[{"Interval", "[",
RowBox[{"KZ", "[",
RowBox[{"[", "1", "]"}], "]"}], "]"}], ",", "i"}], "]"}],
"\[Equal]", "True"}], ",",
RowBox[{
RowBox[{"tmp", "=",
RowBox[{"ReplacePart", "[",
RowBox[{"tmp", ",",
RowBox[{"i", "\[Rule]", "1"}]}], "]"}]}], ";"}]}], "]"}],
";", "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"IntervalMemberQ", "[",
RowBox[{
RowBox[{"Interval", "[",
RowBox[{"KZ", "[",
RowBox[{"[", "2", "]"}], "]"}], "]"}], ",", "i"}], "]"}],
"\[Equal]", "True"}], ",",
RowBox[{
RowBox[{"tmp", "=",
RowBox[{"ReplacePart", "[",
RowBox[{"tmp", ",",
RowBox[{"i", "\[Rule]", "2"}]}], "]"}]}], ";"}]}], "]"}],
";", "\[IndentingNewLine]",
RowBox[{"If", "[",
RowBox[{
RowBox[{
RowBox[{"IntervalMemberQ", "[",
RowBox[{
RowBox[{"Interval", "[",
RowBox[{"KZ", "[",
RowBox[{"[", "3", "]"}], "]"}], "]"}], ",", "i"}], "]"}],
"\[Equal]", "True"}], ",",
RowBox[{
RowBox[{"tmp", "=",
RowBox[{"ReplacePart", "[",
RowBox[{"tmp", ",",
RowBox[{"i", "\[Rule]", "3"}]}], "]"}]}], ";"}]}], "]"}],
";"}]}], "]"}], ";", "\[IndentingNewLine]", "tmp"}]}], "]"}]}],
";", "\n", "\[IndentingNewLine]",
RowBox[{"(*", " ",
RowBox[{"sequestration", " ", "function"}], " ", "*)"}],
"\[IndentingNewLine]",
RowBox[{
RowBox[{"PRingFunc", "[",
RowBox[{"i_Integer", ",", "a1_Integer", ",", "a2_Integer"}], "]"}], ":=",
RowBox[{"Piecewise", "[",
RowBox[{"{",
RowBox[{
RowBox[{"{",
RowBox[{"1", ",",
RowBox[{"i", "<", "a1"}]}], "}"}], ",",
RowBox[{"{",
RowBox[{
RowBox[{"Exp", "[",
RowBox[{
RowBox[{"Log", "[", "0.5", "]"}], "*",
RowBox[{
RowBox[{"(",
RowBox[{"i", "-", "a1"}], ")"}], "/",
RowBox[{"(",
RowBox[{"a2", "-", "a1"}], ")"}]}]}], "]"}], ",",
RowBox[{"i", "\[GreaterEqual]", "a1"}]}], "}"}]}], "}"}], "]"}]}],
";", "\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{
RowBox[{"LsDot", "[",
RowBox[{"ls1_List", ",", "ls2_List"}], "]"}], ":=",
RowBox[{"ls1", "*", "ls2"}]}], ";", "\[IndentingNewLine]",
"\[IndentingNewLine]",
RowBox[{
RowBox[{"ParasiteDynamics", "[",
RowBox[{
"initN_", ",", "PMR_Integer", ",", "mu_", ",", "sigma_", ",",
"hours_Integer", ",", "KZ_List", ",", "concdat_List", ",",
"everyH_Integer", ",", "Ndrug_Integer", ",", "gamma_List", ",",
"ec50_List", ",", "emin_List", ",", "emax_List", ",", "T_Real", ",",
"runMax_Integer"}], "]"}], ":=",
RowBox[{"Module", "[",
RowBox[{
RowBox[{"{",
RowBox[{
RowBox[{"runs", "=", "True"}], ",", "stages", ",", "concls", ",",
"i", ",", "j", ",", "lst", ",", "lsk", ",",
RowBox[{"output", "=",
RowBox[{"{", "}"}]}], ",", "xm", ",", "ym", ",", "a", ",", "ke",
",", "junk", ",", "onlyring", ",", "tot"}], "}"}], ",",
"\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{
"template", " ", "of", " ", "the", " ", "drug", " ", "and", " ",
"its", " ", "effects"}], "*)"}], "\[IndentingNewLine]",
RowBox[{
RowBox[{"xm", "=",
RowBox[{"concdat", "[",
RowBox[{"[", "1", "]"}], "]"}]}], ";", "\[IndentingNewLine]",
RowBox[{"ym", "=",
RowBox[{"concdat", "[",
RowBox[{"[", "2", "]"}], "]"}]}], ";", "\[IndentingNewLine]",
RowBox[{"a", "=",
RowBox[{"concdat", "[",
RowBox[{"[", "3", "]"}], "]"}]}], ";", "\[IndentingNewLine]",
RowBox[{"ke", "=",
RowBox[{"concdat", "[",
RowBox[{"[", "4", "]"}], "]"}]}], ";", "\[IndentingNewLine]",
RowBox[{"concls", "=",
RowBox[{"ConcMod", "[",
RowBox[{
"xm", ",", "ym", ",", "a", ",", "ke", ",", "everyH", ",", "Ndrug",
",", "gamma", ",", "ec50", ",", "emin", ",", "emax"}], "]"}]}],
";", "\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{"k_i", " ",
RowBox[{"(", "t", ")"}]}], "*)"}], "\[IndentingNewLine]",
RowBox[{"lsk", "=",
RowBox[{"Ki", "[",
RowBox[{"T", ",", "concls"}], "]"}]}], ";", "\[IndentingNewLine]",
RowBox[{"(*",
RowBox[{"initial", " ", "parasite", " ", "load"}], "*)"}],
"\[IndentingNewLine]",
RowBox[{"lst", "=",
RowBox[{"DistributeN", "[",
RowBox[{"initN", ",", "hours", ",", "mu", ",", "sigma"}], "]"}]}],
";", "\[IndentingNewLine]", "\[IndentingNewLine]",
RowBox[{"stages", "=",
RowBox[{"WhichRTS", "[",
RowBox[{"lst", ",", "KZ"}], "]"}]}], ";", "\[IndentingNewLine]",
"\[IndentingNewLine]",
RowBox[{"AppendTo", "[",
RowBox[{"output", ",", "lst"}], "]"}], ";", "\[IndentingNewLine]",
RowBox[{"i", "=", "0"}], ";", "\[IndentingNewLine]",
RowBox[{"While", "[",
RowBox[{
RowBox[{
RowBox[{"runs", "\[Equal]", "True"}], "&&",
RowBox[{"i", "<", "runMax"}]}], ",", "\[IndentingNewLine]",
RowBox[{
RowBox[{"i", "=",
RowBox[{"i", "+", "1"}]}], ";", "\[IndentingNewLine]",
"\[IndentingNewLine]",
RowBox[{"(*",