diff --git a/test/quintic_hermite_test.cpp b/test/quintic_hermite_test.cpp index befafbb44..1de07092d 100644 --- a/test/quintic_hermite_test.cpp +++ b/test/quintic_hermite_test.cpp @@ -112,6 +112,35 @@ void test_cubic() } } +template +void test_quartic() +{ + + std::vector x{0,1,2,3, 4,5,6,7,8,9, 10, 11}; + std::vector y(x.size()); + for (size_t i = 0; i < y.size(); ++i) + { + y[i] = x[i]*x[i]*x[i]*x[i]/24; + } + + std::vector dydx(x.size()); + for (size_t i = 0; i < y.size(); ++i) { + dydx[i] = x[i]*x[i]*x[i]/6; + } + + std::vector d2ydx2(x.size()); + for (size_t i = 0; i < y.size(); ++i) { + d2ydx2[i] = x[i]*x[i]/2; + } + + auto qh = quintic_hermite(std::move(x), std::move(y), std::move(dydx), std::move(d2ydx2)); + + for (Real t = 0; t <= 9; t += 0.125) { + CHECK_ULP_CLOSE(Real(t*t*t*t)/24, qh(t), 43); + } +} + + template void test_interpolation_condition() { @@ -152,18 +181,21 @@ int main() test_linear(); test_quadratic(); test_cubic(); + test_quartic(); test_interpolation_condition(); test_constant(); test_linear(); test_quadratic(); test_cubic(); + test_quartic(); test_interpolation_condition(); test_constant(); test_linear(); test_quadratic(); test_cubic(); + test_quartic(); test_interpolation_condition(); #ifdef BOOST_HAS_FLOAT128 @@ -171,6 +203,7 @@ int main() test_linear(); test_quadratic(); test_cubic(); + test_quartic(); #endif return boost::math::test::report_errors();