diff options
author | Tavian Barnes <tavianator@gmail.com> | 2011-06-10 01:21:32 -0600 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2011-06-10 01:21:32 -0600 |
commit | 1d2bcd60d3e0cb8649ba5d2ae8672457849656ce (patch) | |
tree | 0fdec95e8d38eab2bd922dfdada6731823e5a37b /tests | |
parent | d03ab99aa999544403652e0739c9bea3b8b7835e (diff) | |
download | vz-1d2bcd60d3e0cb8649ba5d2ae8672457849656ce.tar.xz |
Make the test DE care about x.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/BS23.cpp | 4 | ||||
-rw-r--r-- | tests/CK45.cpp | 4 | ||||
-rw-r--r-- | tests/Complex.cpp | 6 | ||||
-rw-r--r-- | tests/DP45.cpp | 6 | ||||
-rw-r--r-- | tests/Euler.cpp | 6 | ||||
-rw-r--r-- | tests/HE12.cpp | 6 | ||||
-rw-r--r-- | tests/Heun.cpp | 6 | ||||
-rw-r--r-- | tests/Midpoint.cpp | 6 | ||||
-rw-r--r-- | tests/RK4.cpp | 6 | ||||
-rw-r--r-- | tests/RKF45.cpp | 6 |
10 files changed, 28 insertions, 28 deletions
diff --git a/tests/BS23.cpp b/tests/BS23.cpp index 91a5b67..2c030d6 100644 --- a/tests/BS23.cpp +++ b/tests/BS23.cpp @@ -23,11 +23,11 @@ #include <iostream> #include <iomanip> -// y' = y (y == C*exp(x)) +// y' = x*y (y == C*exp(x^2/2)) double f(double x, double y) { - return y; + return x*y; } int diff --git a/tests/CK45.cpp b/tests/CK45.cpp index 0d95f67..7d2d390 100644 --- a/tests/CK45.cpp +++ b/tests/CK45.cpp @@ -23,11 +23,11 @@ #include <iostream> #include <iomanip> -// y' = y (y == C*exp(x)) +// y' = x*y (y == C*exp(x^2/2)) double f(double x, double y) { - return y; + return x*y; } int diff --git a/tests/Complex.cpp b/tests/Complex.cpp index a81deeb..01d850b 100644 --- a/tests/Complex.cpp +++ b/tests/Complex.cpp @@ -24,11 +24,11 @@ #include <iostream> #include <iomanip> -// y' = -y (y == C*exp(x)) +// y' = x*y (y == C*exp(x^2/2)) std::complex<double> f(double x, std::complex<double> y) { - return y; + return x*y; } int @@ -53,7 +53,7 @@ main() << "Rejections: " << integrator.rejections() << std::endl; double error = std::abs(expected - actual)/std::abs(expected); - if (error > 6.0e-7 || !std::isfinite(error)) { + if (error > 5.9e-7 || !std::isfinite(error)) { std::cerr << "Error: " << 100.0*error << "%" << std::endl; return EXIT_FAILURE; } else { diff --git a/tests/DP45.cpp b/tests/DP45.cpp index 237672d..2a80ed3 100644 --- a/tests/DP45.cpp +++ b/tests/DP45.cpp @@ -23,11 +23,11 @@ #include <iostream> #include <iomanip> -// y' = y (y == C*exp(x)) +// y' = x*y (y == C*exp(x^2/2)) double f(double x, double y) { - return y; + return x*y; } int @@ -52,7 +52,7 @@ main() << "Rejections: " << integrator.rejections() << std::endl; double error = std::abs(expected - actual)/std::abs(expected); - if (error > 6.0e-7 || !std::isfinite(error)) { + if (error > 5.9e-7 || !std::isfinite(error)) { std::cerr << "Error: " << 100.0*error << "%" << std::endl; return EXIT_FAILURE; } else { diff --git a/tests/Euler.cpp b/tests/Euler.cpp index 1741dc8..47b5b55 100644 --- a/tests/Euler.cpp +++ b/tests/Euler.cpp @@ -23,11 +23,11 @@ #include <iostream> #include <iomanip> -// y' = y (y == C*exp(x)) +// y' = x*y (y == C*exp(x^2/2)) double f(double x, double y) { - return y; + return x*y; } int @@ -49,7 +49,7 @@ main() << "Iterations: " << integrator.iterations() << std::endl; double error = std::abs(expected - actual)/std::abs(expected); - if (error > 0.01 || !std::isfinite(error)) { + if (error > 2.3e-2 || !std::isfinite(error)) { std::cerr << "Error: " << 100.0*error << "%" << std::endl; return EXIT_FAILURE; } else { diff --git a/tests/HE12.cpp b/tests/HE12.cpp index 8de11e8..c3515c2 100644 --- a/tests/HE12.cpp +++ b/tests/HE12.cpp @@ -23,11 +23,11 @@ #include <iostream> #include <iomanip> -// y' = y (y == C*exp(x)) +// y' = x*y (y == C*exp(x^2/2)) double f(double x, double y) { - return y; + return x*y; } int @@ -52,7 +52,7 @@ main() << "Rejections: " << integrator.rejections() << std::endl; double error = std::abs(expected - actual)/std::abs(expected); - if (error > 8.7e-7 || !std::isfinite(error)) { + if (error > 4.9e-7 || !std::isfinite(error)) { std::cerr << "Error: " << 100.0*error << "%" << std::endl; return EXIT_FAILURE; } else { diff --git a/tests/Heun.cpp b/tests/Heun.cpp index 6eca969..f1b4364 100644 --- a/tests/Heun.cpp +++ b/tests/Heun.cpp @@ -23,11 +23,11 @@ #include <iostream> #include <iomanip> -// y' = y (y == C*exp(x)) +// y' = x*y (y == C*exp(x^2/2)) double f(double x, double y) { - return y; + return x*y; } int @@ -49,7 +49,7 @@ main() << "Iterations: " << integrator.iterations() << std::endl; double error = std::abs(expected - actual)/std::abs(expected); - if (error > 1.4e-4 || !std::isfinite(error)) { + if (error > 2.7e-4 || !std::isfinite(error)) { std::cerr << "Error: " << 100.0*error << "%" << std::endl; return EXIT_FAILURE; } else { diff --git a/tests/Midpoint.cpp b/tests/Midpoint.cpp index 77c7f68..c6f9ef6 100644 --- a/tests/Midpoint.cpp +++ b/tests/Midpoint.cpp @@ -23,11 +23,11 @@ #include <iostream> #include <iomanip> -// y' = y (y == C*exp(x)) +// y' = x*y (y == C*exp(x^2/2)) double f(double x, double y) { - return y; + return x*y; } int @@ -49,7 +49,7 @@ main() << "Iterations: " << integrator.iterations() << std::endl; double error = std::abs(expected - actual)/std::abs(expected); - if (error > 1.4e-4 || !std::isfinite(error)) { + if (error > 4.6e-4 || !std::isfinite(error)) { std::cerr << "Error: " << 100.0*error << "%" << std::endl; return EXIT_FAILURE; } else { diff --git a/tests/RK4.cpp b/tests/RK4.cpp index 9edeb1c..f442a71 100644 --- a/tests/RK4.cpp +++ b/tests/RK4.cpp @@ -23,11 +23,11 @@ #include <iostream> #include <iomanip> -// y' = y (y == C*exp(x)) +// y' = x*y (y == C*exp(x^2/2)) double f(double x, double y) { - return y; + return x*y; } int @@ -49,7 +49,7 @@ main() << "Iterations: " << integrator.iterations() << std::endl; double error = std::abs(expected - actual)/std::abs(expected); - if (error > 4.2e-8 || !std::isfinite(error)) { + if (error > 2.2e-7 || !std::isfinite(error)) { std::cerr << "Error: " << 100.0*error << "%" << std::endl; return EXIT_FAILURE; } else { diff --git a/tests/RKF45.cpp b/tests/RKF45.cpp index 164aba3..11ee539 100644 --- a/tests/RKF45.cpp +++ b/tests/RKF45.cpp @@ -23,11 +23,11 @@ #include <iostream> #include <iomanip> -// y' = y (y == C*exp(x)) +// y' = x*y (y == C*exp(x^2/2)) double f(double x, double y) { - return y; + return x*y; } int @@ -52,7 +52,7 @@ main() << "Rejections: " << integrator.rejections() << std::endl; double error = std::abs(expected - actual)/std::abs(expected); - if (error > 1.7e-6 || !std::isfinite(error)) { + if (error > 1.1e-5 || !std::isfinite(error)) { std::cerr << "Error: " << 100.0*error << "%" << std::endl; return EXIT_FAILURE; } else { |