1 ////////////////////////////////////////////////////////////////////////////
2 // Model bessel.cc               SIMLIB/C++
3 //
4 // Besselova diferenci�ln� rovnice:
5 //
6 //   y '' + (1/t) * y ' + (1 - 1/t*t) * y = 0
7 //
8 // s podm�nkami y(0.001) = 0.001, y '(0.001) = 0.49999
9 //
10 
11 #include "simlib.h"
12 
13 class Bessel { // Besselova diferenci�ln� rovnice
14   Integrator yi,y;
15  public:
Bessel()16   Bessel():
17     yi( -(1/T)*yi+(1/(T*T)-1)*y , 0.49999),
18     y( yi , 0.001)  {}
Y()19   double Y() { return y.Value(); }
YI()20   double YI() { return yi.Value(); }
21 };
22 
23 Bessel bes;
24 
Sample()25 void Sample() {                 // vzorkovac� funkce
26   Print("%-8g  %g  %g\n", T.Value(), bes.Y(), bes.YI());
27 }
28 Sampler S(Sample,0.2);          // vzorkovac� objekt
29 
main()30 int main() {                    // popis experimentu
31     SetOutput("bessel.dat");
32     Print("# Besselova diferenci�ln� rovnice \n");
33     Print("# Time    y     y'\n");
34     SetStep(1e-6, 0.1);         // krok
35     Init(0.001, 50);            // inicializace experimentu
36     Run();                      // simulace
37     SIMLIB_statistics.Output(); // print run statistics
38 }
39 
40 //
41