#include <array>
#include <cmath>
+#include <numeric>
#include "../tests.h"
deallog << "testing cross derivative "
<< cross_derivative_n
<< std::endl;
+ std::vector<double> steps;
+ std::vector<double> errors;
for (unsigned int step_n = 5; step_n < 10; ++step_n)
{
- deallog << cross_stencil<structdim>(cross_derivatives[cross_derivative_n],
+ const double current_step = std::pow(0.5, double(step_n));
+ steps.push_back(std::log(current_step));
+ errors.push_back(std::log(std::abs(cross_stencil<structdim>
+ (cross_derivatives[cross_derivative_n],
c0,
- std::pow(0.5, double(step_n)),
- objective) - exact[cross_derivative_n]
- << std::endl;
+ current_step,
+ objective)
+ - exact[cross_derivative_n])));
}
+
+ const double mean_step = std::accumulate(steps.begin(), steps.end(), 0.0)/steps.size();
+ const double mean_error = std::accumulate(errors.begin(), errors.end(), 0.0)/errors.size();
+
+ double numerator = 0.0;
+ double denominator = 0.0;
+ for (std::size_t i = 0; i < steps.size(); ++i)
+ {
+ numerator += (steps[i] - mean_step)*(errors[i] - mean_error);
+ denominator += Utilities::fixed_power<2>(steps[i] - mean_step);
+ }
+ deallog << "slope is nearly 3: "
+ << (std::abs(numerator/denominator - 3.0) < 0.05)
+ << std::endl;
}
}
DEAL::testing cross derivative 0
-DEAL::2.08262e-05
-DEAL::2.61032e-06
-DEAL::3.26714e-07
-DEAL::4.08654e-08
-DEAL::5.10984e-09
+DEAL::slope is nearly 3: 1
DEAL::testing cross derivative 1
-DEAL::2.10357e-05
-DEAL::2.62342e-06
-DEAL::3.27533e-07
-DEAL::4.09167e-08
-DEAL::5.11266e-09
+DEAL::slope is nearly 3: 1
DEAL::testing cross derivative 2
-DEAL::5.75514e-06
-DEAL::7.19207e-07
-DEAL::8.98876e-08
-DEAL::1.12350e-08
-DEAL::1.40439e-09
+DEAL::slope is nearly 3: 1
DEAL::
DEAL::Project the arithmetic mean of two vertices on a circular
DEAL::arc. The result should be the geodesic midpoint:
DEAL::testing cross derivative 0
-DEAL::2.08262e-05
-DEAL::2.61032e-06
-DEAL::3.26714e-07
-DEAL::4.08653e-08
-DEAL::5.10978e-09
+DEAL::slope is nearly 3: 1
DEAL::testing cross derivative 1
-DEAL::2.10357e-05
-DEAL::2.62342e-06
-DEAL::3.27533e-07
-DEAL::4.09166e-08
-DEAL::5.11283e-09
+DEAL::slope is nearly 3: 1
DEAL::testing cross derivative 2
-DEAL::5.75514e-06
-DEAL::7.19207e-07
-DEAL::8.98876e-08
-DEAL::1.12351e-08
-DEAL::1.40411e-09
+DEAL::slope is nearly 3: 1
DEAL::
DEAL::Project the arithmetic mean of two vertices on a circular
DEAL::arc. The result should be the geodesic midpoint: