help-gsl
[Top][All Lists]

## [Help-gsl] Need help with negative arguments to gsl_sf_ellint_Kcomp, com

 From: Jerry Subject: [Help-gsl] Need help with negative arguments to gsl_sf_ellint_Kcomp, complete elliptic integral of the first kind Date: Fri, 24 Apr 2015 02:55:52 -0700

```Hi list,

I'm having trouble understanding how to use gsl_sf_ellint_Kcomp, the complete
elliptic integral of the first kind, K(k).

First, gsl_sf_ellint_Kcomp has a domain limited to -1 < k < +1 and raises an
error for arguments outside that range.

Second, gsl_sf_ellint_Kcomp defines a function with even symmetry around k = 0.
-
The corresponding Octave, Mathematica, and I presume Matlab functions are all
non-symmetric and they all decay towards zero as the argument tends to from +1
to -infinity. (Mathematica also returns a real result for arguments > 1.)
Octave and Mathematica both reference Abramowitz & Stegun without
qualification, whereas the GSL reference says that "Note that Abramowitz &
Stegun define this function in terms of the parameter m = k^2."

For arguments between 0 and 1, taking the square root before passing to
gsl_sf_ellint_Kcomp returns a result consistent with the other references
herein (Octave, Mathematica). However, I don't know how to get results for
arguments less than zero that are also consistent with those references.
Abramowitz & Stegun provides a bunch of ways of handling various kinds of
arguments but I can't find one that is suitable.

For what it's worth, this function arises in the probability density function
of the sum of two random sine variables. For unit-amplitude sine RVs, the
argument to gsl_sf_ellint_Kcomp is always between 0 and 1 so to proceed with
programming that problem I don't really need to have the question herein
answered, but I would like to know how to handle it in the future should it
arise.

Thanks for any help.

Jerry

```