GNU Scientific Library

From Wikipedia, the free encyclopedia

GNU Scientific Library
Developed by GNU Project
Latest release 1.11 / 31 March 2008
Genre Numerical library
License GNU General Public License
Website http://www.gnu.org/software/gsl/

In computing, GNU Scientific Library (or GSL) is a software library written in the C programming language for numerical calculations in applied mathematics and science. The GSL is part of the GNU project and is distributed under the GNU General Public License.

The GSL can be used in C++, but not using pointers to member functions, because the type of pointer to member function is different from pointer to function [1]. Instead, C++ programmers can use static functions redirecting to the correct member function, since the address used for static member functions in C++ is compatible with the GSL. C++ wrappers for GSL are available [2].

Software which uses GSL includes Octave, PSPP and Perl Data Language.

Contents

[edit] Example

The following example program calculates the value of the Bessel function for 5 [3]:

#include <stdio.h>
#include <gsl/gsl_sf_bessel.h>

int
main (void)
{
  double x = 5.0;
  double y = gsl_sf_bessel_J0 (x);
  printf ("J0(%g) = %.18e\n", x, y);
  return 0;
}

The example program has to be linked to the GSL library upon compilation:

gcc $(gsl-config --cflags) example.c $(gsl-config --libs)

The output is shown below, and should be correct to double-precision accuracy:

J0(5) = -1.775967713143382920e-01

[edit] Features

The software library provides facilities for:

[edit] See also

[edit] External links