The NAG C Library - Included in Mark 23

Now at Mark 23, the NAG C Library contains over 1,400 algorithms which are powerful, reliable, flexible and ready for use from a wide range of operating systems, languages, environments and packages including Excel, Java, .NET, C#, VB and many more.

We've selected key highlights from the NAG Library and show in more detail how a particular function or set of functions can be used. A full comprehensive overview of what's new can be found in the user manual.

To learn more about a specific area/function click on the relevant link below.

New functionality at Mark 23

Global Optimization techniques

"In my work on financial optimization I was researching a problem in portfolio selection which turned out to have multiple solutions. The model I was using was not continuously differentiable and so I needed a direct search (non-gradient) solution method. Neumaier's Multi-level Coordinate Splitting technique seemed a suitable choice and I was able to obtain a copy of the beta-test version of the NAG implementation of this approach. I am pleased to say that it yielded satisfactory solutions to my problem. More important, from my research and development point of view, the software offers a user plenty of choice and control over the way the calculation is performed, the accuracy of the search and the final stopping criteria. This flexibility is very valuable when one is working with a new and untried optimization model."

Dr Michael Bartholomew-Biggs
Head of Numerical Optimization Centre and School of Physics Astronomy and Mathematics, University of Hertford


Extensions to the Library have been made in many areas namely statistics, optimization, linear algebra, ordinary differential equations, regression, random number generators and special functions.

  • Values of the complex Lambert-W function. (NAG Library Chapter C05- Roots of Transcendental Equations)
  • Summing a Chebyshev series. (NAG Library Chapter Chapter C06 - Summation of Series)
  • One and two-dimensional discrete wavelet transforms (NAG Library Chapter C09 - Wavelet Transforms)
  • Solve boundary-value problems by Chebyshev pseudospectral method (NAG Library Chapter D02 - Ordinary Differential Equations)
  • Interpolation of four- and five-dimensional data (NAG Library Chapter E01 - Interpolation)
  • Derivatives of a bicubic spline fit (NAG Library Chapter E02 - Curve and Surface Fitting)
  • BOBYQA; minimization by quadratic approximation (NAG Library Chapter E04 - Minimizing or Maximizing a function)
  • Multi-start Optimization and Particle Swarm Optimization (NAG Library Chapter E05 - Global Optimization).
  • Matrix exponentials and functions of symmetric/Hermitian matrices (NAG Library Chapter F01 - Matrix Operations)
  • Sparse Matrix functions (NAG Chapter F11 - Large Scale Eigenproblems)
  • Skip-ahead for the Mersenne Twister, and L'Ecuyer MRG32K3a generator (NAG Library Chapter G05 - Random Number Generators)
  • Pareto distribution parameter estimation and outlier detection (NAG Library Chapter G07 - Univariate Estimation)
  • Anderson-Darling goodness-of-fit test (NAG Library Chapter G08 -Nonparametric Statistics)
  • Rank statistics when comparing survival curves (NAG Library Chapter G12 - Survival Analysis)
  • Greeks for Heston's model option pricing formula (NAG Library Chapter S30 - special functions)

The new functionality added at Mark 23 further enhances the comprehensive collection of numerical and statistical techniques offered by the library:

Numerical facilities

Option Pricing Formulae

"We use NAG at the Manchester Business School, first and foremost, because we trust its accuracy. The introduction of NAG option pricing routines accessible from MATLAB and Excel-VBA has greatly expanded its clientele from a small group of hard core Fortran and C/C++ programmers to large population of PhD Finance, MSc Quantitative Finance, MSc Mathematical Finance, and finance specialist undergraduate students. NAG has made complex derivative models accessible to a much wider audience whose primary goal is to understand the models instead of being bogged down by the nuts-and-bolts of coding. Even for the hard core option pricing experts, now that they do not have to reinvent the wheel all the times, they can concentrate on advancing the models. The MATLAB and Excel-VBA interface allows the experienced hard Quant to build up prototype models quickly."

Dr Ser-Huang Poon
Professor of Finance, Manchester Business School, University of Manchester

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

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