| Home | Libraries | People | FAQ | More

### Jacobi Zeta Function

##### Synopsis

    #include <boost/math/special_functions/jacobi_zeta.hpp>

    namespace boost { namespace math {

    template <class T1, class T2>
    BOOST_MATH_GPU_ENABLED calculated-result-type jacobi_zeta(T1 k, T2 phi);

    template <class T1, class T2, class Policy>
    BOOST_MATH_GPU_ENABLED calculated-result-type jacobi_zeta(T1 k, T2 phi, const Policy&);

    }} // namespaces

##### Description

This function evaluates the Jacobi Zeta Function Z(φ, k)

Please note the use of φ, and k as the parameters, the function is often defined as Z(φ, m) with m = k2, see for example Weisstein, Eric W. "Jacobi Zeta Function." From MathWorld--A Wolfram Web Resource. Or else as Z(x, k) with φ = am(x, k), where am is the Jacobi amplitude function which is equivalent to asin(jacobi_elliptic(k, x)).

The return type of this function is computed using the result type calculation rules when the arguments are of different types: when they are the same type then the result is the same type as the arguments.

Requires -1 <= k <= 1, otherwise returns the result of domain_error (outside this range the result would be complex).

The final Policy argument is optional and can be used to control the behaviour of the function: how it handles errors, what level of precision to use etc. Refer to the policy documentation for more details.

Note that there is no complete analogue of this function (where φ = π / 2) as this takes the value 0 for all k.

##### Accuracy

These functions are trivially computed in terms of other elliptic integrals and generally have very low error rates (a few epsilon) unless parameter φ is very large, in which case the usual trigonometric function argument-reduction issues apply.

Table 8.68. Error rates for jacobi_zeta

| GNU C++ version 7.1.0 linux double | GNU C++ version 7.1.0 linux long double | Sun compiler version 0x5150 Sun Solaris long double | Microsoft Visual C++ version 14.1 Win32 double
--- | --- | --- | --- | ---
Elliptic Integral Jacobi Zeta: Mathworld Data | Max = 0ε (Mean = 0ε) | Max = 1.66ε (Mean = 0.48ε) | Max = 1.66ε (Mean = 0.48ε) | Max = 1.52ε (Mean = 0.357ε)
Elliptic Integral Jacobi Zeta: Random Data | Max = 0ε (Mean = 0ε) | Max = 2.99ε (Mean = 0.824ε) | Max = 3.96ε (Mean = 1.06ε) | Max = 3.89ε (Mean = 0.824ε)
Elliptic Integral Jacobi Zeta: Large Phi Values | Max = 0ε (Mean = 0ε) | Max = 2.92ε (Mean = 0.951ε) | Max = 3.05ε (Mean = 1.13ε) | Max = 2.52ε (Mean = 0.977ε)

##### Testing

The tests use a mixture of spot test values calculated using values calculated at Wolfram Alpha, and random test data generated using MPFR at 1000-bit precision and a deliberately naive implementation in terms of the Legendre integrals.

##### Implementation

The implementation for Z(φ, k) first makes the argument φ positive using:

> Z(-φ, k) = -Z(φ, k)

The function is then implemented in terms of Carlson's integral RJ using the relation:

There is one special case where the above relation fails: when k = 1, in that case the function simplifies to

> Z(φ, 1) = sign(cos(φ)) sin(φ)

###### Example

A simple example comparing use of Wolfram Alpha with Boost.Math (including much higher precision using Boost.Multiprecision) is jacobi_zeta_example.cpp.