summaryrefslogtreecommitdiffstats
path: root/tests/EquationSystem.cpp
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-10-11 02:51:41 -0400
committerTavian Barnes <tavianator@gmail.com>2010-10-11 02:51:41 -0400
commitf123be63a5760782c563d81d7842de6cc3e5646b (patch)
treeceb533b40e917156cad556ca99c75ebe65ae2d21 /tests/EquationSystem.cpp
parent2c2b69e1df183f118c45d74c18c7e84934aaff1f (diff)
downloadvz-f123be63a5760782c563d81d7842de6cc3e5646b.tar.xz
Support adaptive integration with equation systems.
Diffstat (limited to 'tests/EquationSystem.cpp')
-rw-r--r--tests/EquationSystem.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/EquationSystem.cpp b/tests/EquationSystem.cpp
index 973dd30..497a065 100644
--- a/tests/EquationSystem.cpp
+++ b/tests/EquationSystem.cpp
@@ -22,8 +22,8 @@ main()
Y y;
y[0] = 1.0;
y[1] = 1.0;
- vZ::GenericEulerIntegrator<Y> integrator(f);
- integrator.y(y).x(0.0).h(0.01);
+ vZ::GenericDP45Integrator<Y> integrator(f);
+ integrator.tol(1e-6).y(y).x(0.0).h(0.06);
integrator.integrate(2.0);
@@ -33,10 +33,12 @@ main()
std::cout << std::setprecision(10)
<< "Numerical: " << actual << std::endl
<< "Expected: " << expected << std::endl
- << "Iterations: " << integrator.iterations() << std::endl;
+ << "h: " << integrator.h() << std::endl
+ << "Iterations: " << integrator.iterations() << std::endl
+ << "Rejections: " << integrator.rejections() << std::endl;
double error = std::fabs(expected - actual)/expected;
- if (error > 0.01) {
+ if (error > 6.0e-7) {
std::cerr << "Error: " << 100.0*error << "%" << std::endl;
return EXIT_FAILURE;
} else {