| Home | Libraries | People | FAQ | More

#### Elliptic Integrals of the First Kind - Legendre Form

###### Synopsis

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

    namespace boost { namespace math {

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

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

    template <class T>
    calculated-result-type ellint_1(T k);

    template <class T, class Policy>
    calculated-result-type ellint_1(T k, const Policy&);

    }} // namespaces

###### Description

These two functions evaluate the incomplete elliptic integral of the first kind F(φ, k) and its complete counterpart K(k) = F(π/2, k).

The return type of these functions is computed using the result type calculation rules when T1 and T2 are different types: when they are the same type then the result is the same type as the arguments.

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

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

Returns the incomplete elliptic integral of the first kind F(φ, k):

Requires -1 <= k <= 1, otherwise returns the result of domain_error.

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.

    template <class T>
    calculated-result-type ellint_1(T k);

    template <class T>
    calculated-result-type ellint_1(T k, const Policy&);

Returns the complete elliptic integral of the first kind K(k):

Requires -1 <= k <= 1, otherwise returns the result of domain_error.

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.

###### Accuracy

These functions are computed using only basic arithmetic operations, so there isn't much variation in accuracy over differing platforms. Note that only results for the widest floating point type on the system are given as narrower types have effectively zero error. All values are relative errors in units of epsilon.

Table 41. Errors Rates in the Elliptic Integrals of the First Kind

Significand Size | Platform and Compiler | F(φ, k) | K(k)
--- | --- | --- | ---
53 | Win32 / Visual C++ 8.0 | Peak=3 Mean=0.8 | Peak=1.8 Mean=0.7
64 | Red Hat Linux / G++ 3.4 | Peak=2.6 Mean=1.7 | Peak=2.2 Mean=1.8
113 | HP-UX / HP aCC 6 | Peak=4.6 Mean=1.5 | Peak=3.7 Mean=1.5

###### Testing

The tests use a mixture of spot test values calculated using the online calculator at functions.wolfram.com, and random test data generated using NTL::RR at 1000-bit precision and this implementation.

###### Implementation

These functions are implemented in terms of Carlson's integrals using the relations:

and