NAG Library for Python

The NAG Library for Python, provided as a set of “Bindings” for use in conjunction with the NAG Library, gives access to the mathematical and statistical routines in the NAG Library. A technical document has been written to illustrate use of the Bindings - read it here. It includes an example “calling a NAG Optimization routine utilizing a callback function” using the NAG Library for Python Bindings.

Library Contents

The key numerical and statistical capabilities of the Library are shown below.

Numerical facilities:

  • Optimization, both Local and Global
  • Linear, quadratic, integer and nonlinear programming and least squares problems
  • Ordinary and partial differential equations, and mesh generation
  • Solution of dense, banded and sparse linear equations and eigenvalue problems
  • Solution of linear and nonlinear least squares problems
  • Curve and surface fitting and interpolation
  • Special functions
  • Numerical integration and integral equations
  • Roots of nonlinear equations (including polynomials)
  • Option Pricing Formulae
  • Wavelet Transforms

Statistical facilities:

  • Random number generation
  • Simple calculations on statistical data
  • Correlation and regression analysis
  • Multivariate methods
  • Analysis of variance and contingency table analysis
  • Time series analysis
  • Nonparametric statistics

Regular Updates

To ensure that we meet your existing and future requirements, the library is regularly updated with new and enhanced algorithms for use in evolving business areas. If you have suggestions for new routines please contact us.

Expert Support

Subscription to our dedicated Technical Support Service includes automatic notification of updates and access to our domain experts who are there to assist you with your technical queries or difficulties.

Please contact us if you would like more help with this or with other NAG and Python questions.

Archive Material

To see some more detail of how bindings can be auto generated you may want to read Calling the NAG Fortran Library from Python using F2PY using F2PY.

We acknowledge and thank Mike Croucher ( for his work in using NAG with Python.