static VALUE rb_gsl_sf_legendre_sphPlm_e(VALUE obj, VALUE l, VALUE m, VALUE x) { gsl_sf_result *rslt = NULL; VALUE v; int status; CHECK_FIXNUM(l); CHECK_FIXNUM(m); Need_Float(x); v = Data_Make_Struct(cgsl_sf_result, gsl_sf_result, 0, free, rslt); status = gsl_sf_legendre_sphPlm_e(FIX2INT(l), FIX2INT(m), NUM2DBL(x), rslt); return rb_ary_new3(2, v, INT2FIX(status)); }
/// Spherical Legendre functions. double legendre_sphPlm(unsigned int l, unsigned int m, double theta) { double x = std::cos(theta); if (l < m) return 0.0; else { gsl_sf_result result; int stat = gsl_sf_legendre_sphPlm_e(static_cast<int>(l), static_cast<int>(m), x, &result); if (stat != GSL_SUCCESS) { std::ostringstream msg("Error in legendre_sphPlm"); msg << " l=" << l << " m=" << m << " theta=" << theta; throw std::runtime_error(msg.str()); } else return result.val; } }
double gsl_sf_legendre_sphPlm(const int l, const int m, const double x) { EVAL_RESULT(gsl_sf_legendre_sphPlm_e(l, m, x, &result)); }