math module
Go to file
jzmaddock 03ea9c8d7d
Merge pull request #1080 from boostorg/issue184_2024
Reinstate root finding protection against huge jumps.
2024-02-06 12:34:39 +00:00
.circleci Fix broken link to lambert_w graph. 2021-03-30 18:50:40 +01:00
.drone Add M1 testing to drone (#868) 2023-01-16 11:13:04 -08:00
.github/workflows Update GHA to remove Node deprecation warnings 2024-01-24 11:52:29 +01:00
build Fix up Jamfiles for C++11 s a requirement. 2021-02-13 19:40:50 +00:00
config Revert "Fix for issue #764 (#765)". 2022-03-06 15:24:02 +00:00
doc Random search (#1071) 2024-01-24 17:26:24 -08:00
example Random search (#1071) 2024-01-24 17:26:24 -08:00
include/boost Reinstate root finding protection against huge jumps. 2024-02-05 19:16:33 +00:00
include_private/boost/math Replace casting of 0 to pointer type with nullptr 2022-07-10 18:05:13 -07:00
meta Add codecov run to CI (#1061) 2024-01-05 09:00:24 +01:00
reporting Numerical evaluation of Fourier transform of Daubechies scaling funct… (#921) 2023-06-13 08:05:00 -07:00
src/tr1 Complete removal of direct use of lexical_cast. 2022-01-17 15:36:33 +00:00
test BOOST_ASSERT->BOOST_MATH_ASSERT. 2024-02-06 09:54:49 +00:00
tools Random search (#1071) 2024-01-24 17:26:24 -08:00
.codecov.yml Add codecov run to CI (#1061) 2024-01-05 09:00:24 +01:00 Update sanitizer images (#1011) 2023-08-01 14:25:04 -04:00
.gitattributes Special functions, octonions, quaternions by Hubert Holin 2001-06-23 08:02:37 +00:00
.gitignore Fix race conditions in differential evolution (#1063) 2024-01-17 10:20:41 -08:00
.travis.yml Fix up travis.yml. 2020-07-06 12:06:40 +01:00
CMakeLists.txt Add cmake install 2023-02-15 10:46:01 -08:00
LICENSE Fix for TBB failure and add license [standalone] 2021-04-04 09:54:19 +03:00 Fix race conditions in differential evolution (#1063) 2024-01-17 10:20:41 -08:00
index.html Redirect to new index. 2007-10-11 11:51:19 +00:00

Boost Math Library Build StatusBuild Status

ANNOUNCEMENT: This library now requires a compliant C++14 compiler.

This library is divided into several interconnected parts:

Floating Point Utilities

Utility functions for dealing with floating point arithmetic, includes functions for floating point classification (fpclassify, isnan, isinf etc), sign manipulation, rounding, comparison, and computing the distance between floating point numbers.

Specific Width Floating Point Types

A set of typedefs similar to those provided by <cstdint> but for floating point types.

Mathematical Constants

A wide range of constants ranging from various multiples of π, fractions, Euler's constant, etc.

These are of course usable from template code, or as non-templates with a simplified interface if that is more appropriate.

Statistical Distributions

Provides a reasonably comprehensive set of statistical distributions, upon which higher level statistical tests can be built.

The initial focus is on the central univariate distributions. Both continuous (like normal & Fisher) and discrete (like binomial & Poisson) distributions are provided.

A comprehensive tutorial is provided, along with a series of worked examples illustrating how the library is used to conduct statistical tests.

Special Functions

Provides a small number of high quality special functions; initially these were concentrated on functions used in statistical applications along with those in the Technical Report on C++ Library Extensions.

The function families currently implemented are the gamma, beta & error functions along with the incomplete gamma and beta functions (four variants of each) and all the possible inverses of these, plus the digamma, various factorial functions, Bessel functions, elliptic integrals, hypergeometrics, sinus cardinals (along with their hyperbolic variants), inverse hyperbolic functions, Legrendre/Laguerre/Hermite/Chebyshev polynomials and various special power and logarithmic functions.

All the implementations are fully generic and support the use of arbitrary "real-number" types, including Boost.Multiprecision, although they are optimised for use with types with known significand (or mantissa) sizes: typically float, double or long double.

These functions also provide the basis of support for the TR1 special functions.

Root Finding

A comprehensive set of root-finding algorithms over the real line, both with derivatives and derivative free.


Minimization of cost functions via Brent's method and differential evolution.

Polynomials and Rational Functions

Tools for manipulating polynomials and for efficient evaluation of rationals or polynomials.


Function interpolation via barycentric rational interpolation, compactly supported quadratic, cubic, and quintic B-splines, the Chebyshev transform, trigonometric polynomials, Makima, pchip, cubic Hermite splines, and bilinear interpolation.

Numerical Integration and Differentiation

A reasonably comprehensive set of routines for integration (trapezoidal, Gauss-Legendre, Gauss-Kronrod, Gauss-Chebyshev, double-exponential, and Monte-Carlo) and differentiation (Chebyshev transform, finite difference, the complex step derivative, and forward-mode automatic differentiation).

The integration routines are usable for functions returning complex results - and hence can be used for computation of contour integrals.

Quaternions and Octonions

Quaternion and Octonion are class templates similar to std::complex.

The full documentation is available on

Standalone Mode

Defining BOOST_MATH_STANDALONE allows Boost.Math to be used without any Boost dependencies. Some functionality is reduced in this mode. A static_assert message will alert you if a particular feature has been disabled by standalone mode.

Supported Compilers

The following compilers are tested with the CI system, and are known to work. Starting with Boost 1.76 (April 2021 Release) a compiler that is fully compliant with C++11 is required to use Boost.Math.

  • g++ 5 or later
  • clang++ 5 or later
  • Visual Studio 2015 (14.0) or later

Build Status

Master Develop
Github Actions Build Status Build Status
Drone Build Status Build Status

Support, bugs and feature requests

Bugs and feature requests can be reported through the GitHub issue tracker (see open issues and closed issues).

You can submit your changes through a pull request.

There is no mailing-list specific to Boost Math, although you can use the general-purpose Boost mailing-list using the tag [math].


Clone the whole boost project, which includes the individual Boost projects as submodules (see boost+git doc):

$ git clone
$ cd boost
$ git submodule update --init

The Boost Math Library is located in libs/math/.

Running tests

First, make sure you are in libs/math/test. You can either run all the tests listed in Jamfile.v2 or run a single test:

test$ ../../../b2                        <- run all tests
test$ ../../../b2 static_assert_test     <- single test
test$ # A more advanced syntax, demoing various options for building the tests:
test$ ../../../b2 -a -j2 -q --reconfigure toolset=clang cxxflags="--std=c++14 -fsanitize=address -fsanitize=undefined" linkflags="-fsanitize=undefined -fsanitize=address"

Continuous Integration

The default action for a PR or commit to a PR is for CI to run the full complement of tests. The following can be appended to the end of a commit message to modify behavior:

* [ci skip] to skip all tests
* [linux] to test using GCC Versions 5-12 and Clang Versions 5-14 on Ubuntu LTS versions 18.04-22.04.
* [apple] to test Apple Clang on the latest version of MacOS.
* [windows] to test MSVC-14.0, MSVC-14.2, MSVC-14.3, CYGWIN, and mingw on the latest version of Windows.
* [standalone] to run standalone mode compile tests

Building documentation

Full instructions can be found here, but to reiterate slightly:

libs/math/doc$ brew install docbook-xsl # on mac
libs/math/doc$ touch ~/user-config.jam
libs/math/doc$ # now edit so that:
libs/math/doc$ cat ~/user-config.jam
using darwin ;

using xsltproc ;

using boostbook
    : /usr/local/opt/docbook-xsl/docbook-xsl

using doxygen ;
using quickbook ;
libs/math/doc$ ../../../b2