Mathematical Functions

Mathematical Constants

The mathematical constants defined in GSL are provided as Ruby constants under the module GSL::Math, as

GSL::Math::M_E
GSL::Math::M_PI

See GSL manual for complete list.

Infinities and Not-a-number

Constants

GSL::POSINF
GSL::NEGINF
GSL::NAN

Module functions

GSL::isnan(x)
GSL::isinf(x)
GSL::finite(x)

Elementary Functions

GSL::log1p(x)
GSL::expm1(x)
GSL::hypot(x)
GSL::acosh(x)
GSL::asinh(x)
GSL::atanh(x)
GSL::ldexp(x)
GSL::frexp(x)

Small Integer Powers

GSL::pow_int(x, n)
GSL::pow_2(x)
GSL::pow_3(x)
GSL::pow_4(x)
GSL::pow_5(x)
GSL::pow_6(x)
GSL::pow_7(x)
GSL::pow_8(x)
GSL::pow_9(x)

Testing for Odd and Even Numbers

GSL::is_odd(n)
GSL::IS_ODD(n)
GSL::is_even(n)
GSL::IS_EVEN(n)

Maximum and Minimum functions

GSL::max(a, b)
GSL::MAX(a, b)
GSL::min(a, b)
GSL::MIN(a, b)
Note: there are two types of functions in C, GSL_XXX_DBL() and GSL_XXX_INT(). In Ruby/GSL, an appropriate function is called according to the argument types.

Approximate Comparison of Floating Point Numbers

GSL::fcmp(a, b, epsilon = 1e-10)
GSL::equal?(a, b, epsilon = 1e-10)