diff --git a/include/boost/math/special_functions/detail/hypergeometric_asym.hpp b/include/boost/math/special_functions/detail/hypergeometric_asym.hpp index 965675a9b..70028c16f 100644 --- a/include/boost/math/special_functions/detail/hypergeometric_asym.hpp +++ b/include/boost/math/special_functions/detail/hypergeometric_asym.hpp @@ -22,7 +22,7 @@ inline T hypergeometric_1F1_asym_positive_series(const T& a, const T& b, const T& z, const Policy& pol) { BOOST_MATH_STD_USING - static const char* const function = "boost::math::hypergeometric_1F1_asym_positive_series<%1%>(%1%,%1%,%1%)"; + //static const char* const function = "boost::math::hypergeometric_1F1_asym_positive_series<%1%>(%1%,%1%,%1%)"; const bool is_a_integer = (a == floor(a)); const bool is_b_integer = (b == floor(b)); @@ -42,7 +42,7 @@ inline T hypergeometric_1F1_asym_negative_series(const T& a, const T& b, const T& z, const Policy& pol) { BOOST_MATH_STD_USING - static const char* const function = "boost::math::hypergeometric_1F1_asym_negative_series<%1%>(%1%,%1%,%1%)"; + //static const char* const function = "boost::math::hypergeometric_1F1_asym_negative_series<%1%>(%1%,%1%,%1%)"; const T b_minus_a = b - a; diff --git a/test/test_1F1.cpp b/test/test_1F1.cpp index e124aa2d6..3f14772ec 100644 --- a/test/test_1F1.cpp +++ b/test/test_1F1.cpp @@ -54,10 +54,13 @@ void expected_results() BOOST_AUTO_TEST_CASE( test_main ) { - typedef boost::multiprecision::number > dec_40; + //typedef boost::multiprecision::number > dec_40; expected_results(); BOOST_MATH_CONTROL_FP; + test_hypergeometric_mellin_transform(); + test_hypergeometric_laplace_transform(); + #ifndef BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS //test_spots(0.0F, "float"); #endif diff --git a/test/test_1F1.hpp b/test/test_1F1.hpp index d641b81cb..b7ab20625 100644 --- a/test/test_1F1.hpp +++ b/test/test_1F1.hpp @@ -23,6 +23,7 @@ #include "table_type.hpp" #include +#include template void do_test_2F0(const T& data, const char* type_name, const char* test_name) @@ -82,3 +83,52 @@ void test_spots(T z, const char* type_name) test_spots1(z, type_name); test_spots2(z, type_name); } + + +// Tests the Mellin transform formula given here: https://dlmf.nist.gov/13.10, Equation 13.10.10 +template +void test_hypergeometric_mellin_transform() +{ + using boost::math::hypergeometric_1F1; + using boost::math::quadrature::exp_sinh; + using boost::math::tgamma; + using std::pow; + + // Constraint: 0 < lambda < a. + Real lambda = 0.5; + Real a = 1; + Real b = 3; + auto f = [&](Real t)->Real { return pow(t, lambda - 1)*hypergeometric_1F1(a, b, -t); }; + + auto integrator = exp_sinh(); + Real computed = integrator.integrate(f, boost::math::tools::epsilon()); + Real expected = tgamma(b)*tgamma(lambda)*tgamma(a-lambda)/(tgamma(a)*tgamma(b-lambda)); + + Real tol = boost::math::tools::epsilon() * 10; + BOOST_CHECK_CLOSE(computed, expected, tol); +} + + +// Tests the Laplace transform formula given here: https://dlmf.nist.gov/13.10, Equation 13.10.4 +template +void test_hypergeometric_laplace_transform() +{ + using boost::math::hypergeometric_1F1; + using boost::math::quadrature::exp_sinh; + using boost::math::tgamma; + using std::pow; + using std::exp; + + // Set a = 1 blows up for some reason . . . + Real a = -1; + Real b = 3; + Real z = 1.5; + auto f = [&](Real t)->Real { return exp(-z*t)*pow(t, b - 1)*hypergeometric_1F1(a, b, t); }; + + auto integrator = exp_sinh(); + Real computed = integrator.integrate(f, boost::math::tools::epsilon()); + Real expected = tgamma(b)/(pow(z,b)*pow(1-1/z, a)); + + Real tol = boost::math::tools::epsilon() * 200; + BOOST_CHECK_CLOSE(computed, expected, tol); +}