The project is in a healthy, maintained state
Provides GNU Scientific Library numerical integration routines under Numo::GSL::Integration.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

Numo::GSL::Integration

numo-gsl-integration provides numerical integration routines from the GNU Scientific Library (GSL) under the Numo::GSL::Integration namespace. It can be installed and loaded without numo-gsl or numo-gsl-alt.

Requirements

  • Ruby 3.2 or later

  • GNU Scientific Library (GSL) 2.8 or later

  • gsl-config available in PATH

    GSL itself must be installed separately.

Installation

Add the gem to your Gemfile:

gem "numo-gsl-integration"

Then run:

bundle install

The native extension uses gsl-config to locate the GSL headers and libraries.

Usage

Load the library:

require "numo/gsl/integration"

For example, use qag to integrate a function over a finite interval:

result, error = Numo::GSL::Integration.qag(0.0, 1.0) do |x|
  x * x
end

Supported routines

Method Interval Intended use
qng Finite Non-adaptive integration of smooth functions
qag Finite General-purpose adaptive integration
qags Finite Functions with integrable singularities or discontinuities
qagp Finite Known singular or discontinuity points
qagi Infinite Integration over the entire real line
qagiu Semi-infinite Integration from a finite lower bound to positive infinity
qagil Semi-infinite Integration from negative infinity to a finite upper bound
qawc Finite Cauchy principal value with a known singular point
qaws Finite Algebraic and logarithmic endpoint singularities
qawo Finite Sine- or cosine-weighted oscillatory integrals
qawf Semi-infinite Sine- or cosine-weighted Fourier integrals
cquad Finite Difficult integrands and endpoint singularities
romberg Finite Smooth functions with extrapolated trapezoidal integration
glfixed Finite Fixed-order Gauss-Legendre integration of smooth functions
fixed Rule-dependent Fixed-order Gaussian quadrature with selectable weight functions
lebedev Unit sphere Lebedev quadrature over the surface of the unit sphere

See Integration routines for parameters and examples.

Documentation

License

This project is licensed under the GNU General Public License version 3 or later. See the LICENSE file for the full license text.