1 #include <iostream>
2 #include <vector>
3 #include <complex>
4 #include <cmath>
5 #include "typedefs.h"
6 #include "check.h"
7 #include "ode.h"
8 #include "functions.h"
9
10 int main()
11 {
12
13 using std::cout;
14 using std::vector;
15 using std::complex;
16
17
18 Floattype eps_machine = 1.0f;
19 while (1.0f + eps_machine != 1.0f)
20 eps_machine /= 2.0f;
21
22 cout << "\n\033[1;33m--- Part C: Solving along a complex path ---\033[0m\n";
23 complex<Floattype> a(0.0f, 0.0f);
24 complex<Floattype> b(2.0f*M_PI, 2.0f*M_PI);
25 cout << "Integration path: b-a = " << b-a << '\n';
26 Inttype n_eqs = 2;
27 vector<complex<Floattype> > y_start(n_eqs);
28 complex<Floattype> y0(0.0f, 0.0f);
29 complex<Floattype> y1(1.0f, 1.0f);
30 y_start[0] = y0;
31 y_start[1] = y1;
32 Floattype h_start = 0.01f;
33 ODE ode(func1,
34 y_start,
35 a,
36 b,
37 h_start,
38 10000,
39 eps_machine*1e12f,
40 eps_machine*1e12f);
41 ode.write("funcC.dat");
42
43
44 cout << "ODE system solved in "
45 << ode.steps() << " steps.\n\n";
46
47
48 return 0;
49 }
50