loom
1import "diff/PredatorPrey.diff" type PredatorPrey;
2
3PredatorPrey PP_init = {
4alpha : 6.0,
5beta : 0.8,
6gamma : 1.0,
7delta : 0.01,
8x : 10.0,
9y : 10.0,
10};
11
12PredatorPrey PP[] = [PP_init, PP_init, PP_init];
13
14PP[0].delta = 0.01;
15PP[1].delta = 0.02;
16PP[2].delta = 0.03;
17
18string s[sys.sizeof(PP)];
19
20chart.init("Модель хищник-жертва");
21
22for(int i=0; i < sys.sizeof(PP); ++i) {
23s[i] = "delta = " + PP[i].delta;
24chart.addSeries(s[i], chart.Style.Spline);
25// chart.addSeries(s[i], chart.Style.Scatter);
26}
27
28void onShow()
29{
30for(int i=0; i < sys.sizeof(PP); ++i)
31chart.addPoint(s[i], PP[i].x, PP[i].y);
32}
33
34scene.setIterationCallback(onShow, 1);
35scene.setT(0.0);
36scene.setTk(3.0);
37scene.setDt(0.1);
38
39for(int i=0; i < sys.sizeof(PP); ++i)
40scene.add(PP[i]);
41
42scene.start();
43