# Boost-Commit :

Subject: [Boost-commit] svn:boost r82557 - trunk/boost/math/special_functions/detail
From: john_at_[hidden]
Date: 2013-01-20 04:57:44

Date: 2013-01-20 04:57:42 EST (Sun, 20 Jan 2013)
New Revision: 82557
URL: http://svn.boost.org/trac/boost/changeset/82557

Log:
More simplifications from Rocco Romeo.
Text files modified:
trunk/boost/math/special_functions/detail/bessel_j1.hpp | 8 ++++----
trunk/boost/math/special_functions/detail/bessel_y1.hpp | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)

Modified: trunk/boost/math/special_functions/detail/bessel_j1.hpp
==============================================================================
--- trunk/boost/math/special_functions/detail/bessel_j1.hpp (original)
+++ trunk/boost/math/special_functions/detail/bessel_j1.hpp 2013-01-20 04:57:42 EST (Sun, 20 Jan 2013)
@@ -170,7 +170,7 @@
BOOST_ASSERT(sizeof(PS) == sizeof(QS));
rc = evaluate_rational(PC, QC, y2);
rs = evaluate_rational(PS, QS, y2);
- factor = sqrt(2 / (w * pi<T>()));
+ factor = 1 / (sqrt(w) * constants::root_pi<T>());
//
// What follows is really just:
//
@@ -178,12 +178,12 @@
// value = factor * (rc * cos(z) - y * rs * sin(z));
//
// but using the sin/cos addition rules plus constants
- // for the values of sin/cos of 3PI/4.
+ // for the values of sin/cos of 3PI/4 which then cancel
+ // out with corresponding terms in "factor".
//
T sx = sin(x);
T cx = cos(x);
- value = factor * (rc * (cx * -constants::one_div_root_two<T>() + sx * constants::half_root_two<T>())
- - y * rs * (sx * -constants::one_div_root_two<T>() - cx * constants::half_root_two<T>()));
+ value = factor * (rc * (sx - cx) + y * rs * (sx + cx));
}

if (x < 0)

Modified: trunk/boost/math/special_functions/detail/bessel_y1.hpp
==============================================================================
--- trunk/boost/math/special_functions/detail/bessel_y1.hpp (original)
+++ trunk/boost/math/special_functions/detail/bessel_y1.hpp 2013-01-20 04:57:42 EST (Sun, 20 Jan 2013)
@@ -172,19 +172,19 @@
T y2 = y * y;
rc = evaluate_rational(PC, QC, y2);
rs = evaluate_rational(PS, QS, y2);
- factor = sqrt(2 / (x * pi<T>()));
+ factor = 1 / (sqrt(x) * root_pi<T>());
//
// This code is really just:
//
// T z = x - 0.75f * pi<T>();
// value = factor * (rc * sin(z) + y * rs * cos(z));
//
- // But using the sin/cos addition rules, plus constants for sin/cos of 3PI/4:
+ // But using the sin/cos addition rules, plus constants for sin/cos of 3PI/4
+ // which then cancel out with corresponding terms in "factor".
//
T sx = sin(x);
T cx = cos(x);
- value = factor * (rc * (sx * -constants::one_div_root_two<T>() - cx * constants::half_root_two<T>())
- + y * rs * (cx * -constants::one_div_root_two<T>() + sx * constants::half_root_two<T>()));
+ value = factor * (y * rs * (sx - cx) - rc * (sx + cx));
}

return value;