-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
38 lines (32 loc) · 799 Bytes
/
main.cpp
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
//
// main.cpp
// ims
//
// Created by xkaisl00, xmatej42.
//
#include "DS.h"
// vypocet Lorenze
struct Lorenz {
DSIntegratorBlock x1, x2, x3;
DSParameterBlock p1, p2, p3, p4;
Lorenz(double sigma, double lambda, double b) :
p1(sigma), p2(lambda), p3(b), p4(1),
x1(p1*(x2 - x1), 1), // dx1/dt = sigma * (x2 - x1)
x2((p4 + p2 - x3)*x1 - x2, 1), // dx2/dt = (1 + lambda - x3) * x1 - x2
x3(x1*x2 - p3*x3, 1){} // dx1/dt = sigma * (x2 - x1)
};
Lorenz L(10, 24, 2);
void Sample() {
print("%6.2f\t %g\t %g\n", t.value(), L.x1.value(), L.x2.value());
}
DSSampler S(&Sample, 0.01);
int main()
{
setMinMaxStep(1e-8,1e-3);
setMethod(ADAMB);
setOutput("pokus.dat");
setAccuracy(1e-8,1e-3);
init(0, 250);
run();
return 0;
}