-
Notifications
You must be signed in to change notification settings - Fork 248
Jacobi Theta functions #394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
898c3ad
c78dcd7
10fc561
4b6701d
9c68c11
aa382f5
45e8ab9
0d3bc43
c293d48
6b8dd5a
08391cd
d73472e
78fc9e2
98bc16c
2ecdf32
32a4d73
a2499bb
041ca09
3a0e3f3
4630855
cf7ff40
b116c75
9fab61b
fb8d3f3
dd2fcd1
d629f80
ef39393
7ecda0f
8cea3e9
2902061
5bea1e5
46c59f8
c9ac3a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
* Add tests covering z=0 special values from MathWorld * Add missing real_concept header * Replace M_PI and friends with constants::pi etc * Use BOOST_MATH_STD_USING in more places
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -166,10 +166,25 @@ template <class RealType, class Policy> | |
| inline RealType jacobi_theta4m1tau(RealType z, RealType tau, const Policy& pol); | ||
|
|
||
| #ifdef __JACOBI_THETA_USE_IMAGINARY | ||
| // The following _IMAGINARY theta functions assume imaginary z and are for | ||
| // internal use only. The z argument is scaled by tau, and sines and cosines | ||
| // are replaced with hyperbolic sines and cosines to accommodate the imaginary | ||
| // argument. (Recall sinh=(exp(x)-exp(-x))/2 and cosh=(exp(x)+exp(-x))/2) | ||
| // | ||
| // The return values are scaled by exp(-tau*z²/π)/sqrt(tau). | ||
| // | ||
| // Using the convention τ'=-1/τ and noting that both τ and τ' are always | ||
| // imaginary (at least in our applications), the _IMAGINARY functions are used | ||
| // to implement the following four relations: | ||
| // | ||
| // [20.7.30] sqrt(-iτ)θ₁(z|τ) = -i*exp(iτ'z²/π)*θ₁(zτ'|τ') | ||
| // [20.7.31] sqrt(-iτ)θ₂(z|τ) = exp(iτ'z²/π)*θ₄(zτ'|τ') | ||
| // [20.7.32] sqrt(-iτ)θ₃(z|τ) = exp(iτ'z²/π)*θ₃(zτ'|τ') | ||
| // [20.7.33] sqrt(-iτ)θ₄(z|τ) = exp(iτ'z²/π)*θ₂(zτ'|τ') | ||
| template <class RealType, class Policy> | ||
| inline RealType | ||
| _IMAGINARY_jacobi_theta1tau(RealType z, RealType tau, const Policy& pol) { | ||
| BOOST_MATH_STD_USING | ||
| BOOST_MATH_STD_USING | ||
| unsigned n = 0; | ||
| RealType eps = policies::get_epsilon<RealType, Policy>(); | ||
| RealType /* q_n, */ delta, delta1, delta2, result = RealType(0); | ||
|
|
@@ -200,7 +215,7 @@ _IMAGINARY_jacobi_theta1tau(RealType z, RealType tau, const Policy& pol) { | |
| template <class RealType, class Policy> | ||
| inline RealType | ||
| _IMAGINARY_jacobi_theta2tau(RealType z, RealType tau, const Policy& pol) { | ||
| BOOST_MATH_STD_USING | ||
| BOOST_MATH_STD_USING | ||
| unsigned n = 0; | ||
| RealType eps = policies::get_epsilon<RealType, Policy>(); | ||
| RealType /* q_n, */ delta, delta1, delta2, result = RealType(0); | ||
|
|
@@ -227,7 +242,7 @@ _IMAGINARY_jacobi_theta2tau(RealType z, RealType tau, const Policy& pol) { | |
| template <class RealType, class Policy> | ||
| inline RealType | ||
| _IMAGINARY_jacobi_theta3tau(RealType z, RealType tau, const Policy& pol) { | ||
| BOOST_MATH_STD_USING | ||
| BOOST_MATH_STD_USING | ||
| unsigned n = 1; | ||
| RealType eps = policies::get_epsilon<RealType, Policy>(); | ||
| RealType /* q_n, */ delta, delta1, delta2, result = exp(-z*z*tau/constants::pi<RealType>()); | ||
|
|
@@ -254,7 +269,7 @@ _IMAGINARY_jacobi_theta3tau(RealType z, RealType tau, const Policy& pol) { | |
| template <class RealType, class Policy> | ||
| inline RealType | ||
| _IMAGINARY_jacobi_theta4tau(RealType z, RealType tau, const Policy& pol) { | ||
| BOOST_MATH_STD_USING | ||
| BOOST_MATH_STD_USING | ||
| unsigned n = 1; | ||
| RealType eps = policies::get_epsilon<RealType, Policy>(); | ||
| RealType /* q_n, */ delta, delta1, delta2, result = exp(-z*z*tau/constants::pi<RealType>()); | ||
|
|
@@ -289,7 +304,7 @@ template <class RealType, class Policy> | |
| inline RealType | ||
| jacobi_theta1tau(RealType z, RealType tau, const Policy& pol) | ||
|
||
| { | ||
| BOOST_MATH_STD_USING | ||
| BOOST_MATH_STD_USING | ||
| unsigned n = 0; | ||
| RealType eps = policies::get_epsilon<RealType, Policy>(); | ||
| RealType q_n, delta, result = RealType(0); | ||
|
|
@@ -341,6 +356,7 @@ inline T jacobi_theta1tau(T z, T tau) { | |
| template <class RealType, class Policy> | ||
| inline RealType | ||
| jacobi_theta1(RealType z, RealType q, const Policy& pol) { | ||
| BOOST_MATH_STD_USING | ||
| if (q <= 0.0 || q >= 1.0) { | ||
| return policies::raise_domain_error<RealType>("boost::math::jacobi_theta1<%1%>(%1%)", | ||
| "q must be greater than 0 and less than 1 but got %1%.", q, pol); | ||
|
|
@@ -359,7 +375,7 @@ template <class RealType, class Policy> | |
| inline RealType | ||
| jacobi_theta2tau(RealType z, RealType tau, const Policy& pol) | ||
| { | ||
| BOOST_MATH_STD_USING | ||
| BOOST_MATH_STD_USING | ||
| unsigned n = 0; | ||
| RealType eps = policies::get_epsilon<RealType, Policy>(); | ||
| RealType q_n, delta, result = RealType(0); | ||
|
|
@@ -407,6 +423,7 @@ inline T jacobi_theta2tau(T z, T tau) { | |
| template <class RealType, class Policy> | ||
| inline RealType | ||
| jacobi_theta2(RealType z, RealType q, const Policy& pol) { | ||
| BOOST_MATH_STD_USING | ||
| if (q <= 0.0 || q >= 1.0) { | ||
| return policies::raise_domain_error<RealType>("boost::math::jacobi_theta2<%1%>(%1%)", | ||
| "q must be greater than 0 and less than 1 but got %1%.", q, pol); | ||
|
|
@@ -458,6 +475,7 @@ template <class RealType, class Policy> | |
| inline RealType | ||
| jacobi_theta3tau(RealType z, RealType tau, const Policy& pol) | ||
| { | ||
| BOOST_MATH_STD_USING | ||
| if (tau <= 0.0) { | ||
| return policies::raise_domain_error<RealType>("boost::math::jacobi_theta3tau<%1%>(%1%)", | ||
| "tau must be greater than 0 but got %1%.", tau, pol); | ||
|
|
@@ -488,6 +506,7 @@ inline T jacobi_theta3tau(T z, T tau) { | |
| template <class RealType, class Policy> | ||
| inline RealType | ||
| jacobi_theta3m1(RealType z, RealType q, const Policy& pol) { | ||
| BOOST_MATH_STD_USING | ||
| if (q <= 0.0 || q >= 1.0) { | ||
| return policies::raise_domain_error<RealType>("boost::math::jacobi_theta3m1<%1%>(%1%)", | ||
| "q must be greater than 0 and less than 1 but got %1%.", q, pol); | ||
|
|
@@ -505,6 +524,7 @@ inline T jacobi_theta3m1(T z, T q) { | |
| template <class RealType, class Policy> | ||
| inline RealType | ||
| jacobi_theta3(RealType z, RealType q, const Policy& pol) { | ||
| BOOST_MATH_STD_USING | ||
| if (q <= 0.0 || q >= 1.0) { | ||
| return policies::raise_domain_error<RealType>("boost::math::jacobi_theta3<%1%>(%1%)", | ||
| "q must be greater than 0 and less than 1 but got %1%.", q, pol); | ||
|
|
@@ -524,7 +544,7 @@ template <class RealType, class Policy> | |
| inline RealType | ||
| jacobi_theta4m1tau(RealType z, RealType tau, const Policy& pol) | ||
| { | ||
| BOOST_MATH_STD_USING | ||
| BOOST_MATH_STD_USING | ||
|
|
||
| RealType eps = policies::get_epsilon<RealType, Policy>(); | ||
| RealType q_n, delta, result = RealType(0); | ||
|
|
@@ -557,6 +577,7 @@ template <class RealType, class Policy> | |
| inline RealType | ||
| jacobi_theta4tau(RealType z, RealType tau, const Policy& pol) | ||
| { | ||
| BOOST_MATH_STD_USING | ||
| if (tau <= 0.0) { | ||
| return policies::raise_domain_error<RealType>("boost::math::jacobi_theta4tau<%1%>(%1%)", | ||
| "tau must be greater than 0 but got %1%.", tau, pol); | ||
|
|
@@ -589,6 +610,7 @@ inline T jacobi_theta4tau(T z, T tau) { | |
| template <class RealType, class Policy> | ||
| inline RealType | ||
| jacobi_theta4m1(RealType z, RealType q, const Policy& pol) { | ||
| BOOST_MATH_STD_USING | ||
| if (q <= 0.0 || q >= 1.0) { | ||
| return policies::raise_domain_error<RealType>("boost::math::jacobi_theta4m1<%1%>(%1%)", | ||
| "q must be greater than 0 and less than 1 but got %1%.", q, pol); | ||
|
|
@@ -606,6 +628,7 @@ inline T jacobi_theta4m1(T z, T q) { | |
| template <class RealType, class Policy> | ||
| inline RealType | ||
| jacobi_theta4(RealType z, RealType q, const Policy& pol) { | ||
| BOOST_MATH_STD_USING | ||
| if (abs(q) >= 1.0 || abs(q) == 0.0) { | ||
| return policies::raise_domain_error<RealType>("boost::math::jacobi_theta4<%1%>(%1%)", | ||
| "|q| must be greater than zero and less than 1, but got %1%.", q, pol); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.