/// Complete elliptic integrals of the first kind. double comp_ellint_1(double k) { const gsl_mode_t mode = GSL_PREC_DOUBLE; gsl_sf_result result; int stat = gsl_sf_ellint_Kcomp_e(k, mode, &result); if (stat != GSL_SUCCESS) { std::ostringstream msg("Error in ellint_1:"); msg << " k=" << k; throw std::runtime_error(msg.str()); } else return result.val; }
double gsl_sf_ellint_Kcomp(double k, gsl_mode_t mode) { EVAL_RESULT(gsl_sf_ellint_Kcomp_e(k, mode, &result)); }
/** * C++ version of gsl_sf_ellint_Kcomp_e(). * Legendre form of complete elliptic integrals * * K(k) = Integral[1/Sqrt[1 - k^2 Sin[t]^2], {t, 0, Pi/2}] * * @param k A real number * @param mode The mode * @param result The result as a @c gsl::sf::result object * @return GSL_SUCCESS or GSL_EDOM */ inline int Kcomp_e( double k, mode_t mode, result& result ){ return gsl_sf_ellint_Kcomp_e( k, mode, &result ); }