The sources of the following examples can be found in the examples/integrate
directory of the CAPD package.
Integration of an ordinary differential equation
#include "capd/capdlib.h"
using namespace std;
{
cout.precision(12);
try{
IMap vectorField(
"par:a,b;var:x,y,z;fun:-(y+z),x+b*y,b+z*(x-a);");
vectorField.setParameter(
"a",
interval(57.)/10.);
vectorField.setParameter(
"b",
interval(2.)/10.);
solver.setAbsoluteTolerance(1e-10);
solver.setRelativeTolerance(1e-10);
c[0] = 0.;
c[1] = -8.3809417428298;
c[2] = 0.029590060630665;
cout << "\ninitial set: " << c;
cout <<
"\ndiam(initial set): " <<
diam(c) << endl;
cout << "\n\nafter time=" << T << " the image is: " << result;
cout <<
"\ndiam(image): " <<
diam(result) << endl << endl;
}catch(exception& e)
{
cout << "\n\nException caught!\n" << e.what() << endl << endl;
}
}
Integration of ODE along with a variational equations
#include "capd/capdlib.h"
using namespace std;
{
cout.precision(12);
try{
IMap vectorField(
"par:a,b;var:x,y,z;fun:-(y+z),x+b*y,b+z*(x-a);");
vectorField.setParameter(
"a",
interval(57.)/10.);
vectorField.setParameter(
"b",
interval(2.)/10.);
c[0] = 0.;
c[1] = -8.3809417428298;
c[2] = 0.029590060630665;
cout << "\ninitial set: " << c;
cout <<
"\ndiam(initial set): " <<
diam(c) << endl;
IVector result = timeMap(T,s,monodromyMatrix);
cout << "\n\nafter time=" << T << " the image is: " << result;
cout <<
"\ndiam(image): " <<
diam(result);
cout << "\n\nmonodromyMatrix:\n" << monodromyMatrix;
cout <<
"\n\ndiam(monodromyMatrix): " <<
diam(monodromyMatrix) << endl << endl;
}catch(exception& e)
{
cout << "\n\nException caught!\n" << e.what() << endl << endl;
}
}