std::comp_ellint_1, std::comp_ellint_1f, std::comp_ellint_1l - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::comp_ellint_1, std::comp_ellint_1f, std::comp_ellint_1l

From cppreference.com
< cpp‎ | experimental‎ | special math

double comp_ellint_1( double arg ); double comp_ellint_1( float arg ); double comp_ellint_1( long double arg ); float comp_ellint_1f( float arg ); long double comp_ellint_1l( long double arg ); | (1) |
double comp_ellint_1( Integral arg ); | (2) |

1) Computes the complete elliptic integral of the first kind of `arg`.
4) A set of overloads or a function template accepting an argument of any integral type. Equivalent to (1) after casting the argument to double.

As all special functions, `comp_ellint_1` is only guaranteed to be available in `<cmath>` if `__STDCPP_MATH_SPEC_FUNCS__` is defined by the implementation to a value at least 201003L and if the user defines `__STDCPP_WANT_MATH_SPEC_FUNCS__` before including any standard library headers.

### [edit] Parameters

arg | - | value of a floating-point or integral type

### [edit] Return value

If no errors occur, value of the complete elliptic integral of the first kind of `arg`, that is ellint_1(arg,π/2), is returned.

### [edit] Error handling

Errors may be reported as specified in math_errhandling

- If the argument is NaN, NaN is returned and domain error is not reported
- If |arg|>1, a domain error may occur

### [edit] Notes

Implementations that do not support TR 29124 but support TR 19768, provide this function in the header `tr1/cmath` and namespace `std::tr1`

An implementation of this function is also available in boost.math

### [edit] Example

(works as shown with gcc 6.0)

Run this code

    #define __STDCPP_WANT_MATH_SPEC_FUNCS__ 1
    #include <cmath>
    #include <iostream>
    int main()
    {
        double hpi = std::acos(-1)/2;
        std::cout << "K(0) = " << std::comp_ellint_1(0) << '\n'
                  << "π/2 = " << hpi << '\n'
                  << "K(0.5) = " << std::comp_ellint_1(0.5) << '\n'
                  << "F(0.5, π/2) = " << std::ellint_1(0.5, hpi) << '\n';
    }

Output:

    K(0) = 1.5708
    π/2 = 1.5708
    K(0.5) = 1.68575
    F(0.5, π/2) = 1.68575

### [edit] External links

Weisstein, Eric W. "Complete Elliptic Integral of the First Kind." From MathWorld--A Wolfram Web Resource.

### [edit] See also

ellint_1ellint_1fellint_1l | (incomplete) elliptic integral of the first kind (function) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/experimental/special_math/comp_ellint_1&oldid=83546"