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-configavailable inPATHGSL itself must be installed separately.
Installation
Add the gem to your Gemfile:
gem "numo-gsl-integration"Then run:
bundle installThe 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
endSupported 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.