Math.NET Numerics Documentation

Math.NET
RSS

Navigation



Quick Search
»
Advanced Search »

Math.NET Project


Wiki

New Admin Files Login Profile

PoweredBy
You can suggest or vote for new features or ideas here.

Core

Namespace: MathNet.Numerics

  • Complex Numbers (including trigonometric functions)
  • Mathematical & Scientific Constants and Prefixes (2007 CODATA)
  • Precision class, for safe floating point handling
  • Various helper and data structure classes

Trigonometry Functions

Namespace: MathNet.Numerics
Class: MathNet.Numerics.Trig

Real and complex trigonometry functions

  • Conversion between degree, radian and grad.
  • Sine, Cosine, Tangent, Cotangent, Secant, Cosecant
  • Inverse: Sine, Cosine, Tangent, Cotangent, Secant, Cosecant
  • Hyperbolic: Sine, Cosine, Tangent, Cotangent, Secant, Cosecant
  • Inverse Hyperbolic: Sine, Cosine, Tangent, Cotangent, Secant, Cosecant

Number Theory

Namespace: MathNet.Numerics.NumberTheory
Class: MathNet.Numerics.NumberTheory.IntegerTheory

  • IsEven, IsOdd
  • IsPowerOfTwo
  • PowerOfTwo, CeilingToPowerOfTwo
  • IsPerfectSquare
  • GreatestCommonDivisor (gcd) of two or more integers
  • ExtendedGreatestCommonDivisor (egcd) of two integers
  • LeastCommonMultiple (lcm) of two or more integers

Numerically Stable Functions

Namespace: MathNet.Numerics
Class: MathNet.Numerics.SpecialFunctions

  • Hypotenuse: (a,b) -> sqrt(a^2+b^2)
  • ExponentialMinusOne: x -> exp(x)-1

Special Functions

Namespace: MathNet.Numerics
Class: MathNet.Numerics.Fn

  • Logarithmic Factorial
  • Factorial
  • Logarithmic Binomial Coefficient
  • Binomial Coefficient

  • Logarithmic Gamma
  • Gamma (supports negative numbers as well)
  • Regularized Gamma

  • Digamma (Psi)
  • Inverse Digamma

  • Logarithmic Beta
  • Regularized Beta

  • Error Function (erf) and complement (erfc)
  • Inverse Error Function and complement

Combinatorics

Namespace: MathNet.Numerics
Class: MathNet.Numerics.Combinatorics

  • Counting: Variations, Variations with repetition, Combinations, Combinations with repetition, Permutations

Probability Distributions

Namespace: MathNet.Numerics.Distributions

Continuous Probability Distributions

Continuous probability distributions support both the probability density function (pdf) and the cumulative distribution function (cdf), as well as the usual probability parameters. Additionally, random numbers can be generated based on the configured probability model parameters and some random number source.

  • Uniform
  • Normal (Gaussian with mean and variance)
  • Gamma
  • Beta
  • Weibull

Discrete Probability Distributions

Discrete probability distributions support both the probability mass function (pmf) and the cumulative distribution function (cdf), as well as the usual probability parameters. Additionally, random numbers can be generated based on the configured probability model parameters and some random number source.

  • Bernoulli

Multivariate Probability Distributions

  • Multinomial
  • Dirichlet

Random Sources

Namespace: MathNet.Numerics.Random

All implementations inherit the .Net framework provided System.Random class for interoperability.

  • Mersenne Twister

Note that random sources should be reused, so be careful to create only one instance (per thread) and share it internally.

Interpolation

Namespace: MathNet.Numerics.Interpolation

Most interpolation algorithms also support numeric differentiation and integration. A facade class Interpolate is provided for easy access, but if needed the algorithms can also be used directly in the Algorithms sub-namespace. All implementations implement the interface IInterpolation.

  • Rational pole-free, on arbitrary points (Barycentric Floater-Hormann Algorithm)
  • Rational with poles, on arbitrary points (Bulirsch & Stoer Algorithm)
  • Neville Polynomial, on arbitrary points (Neville Algorithm)
  • Polynomial, on equidistant points (Barycentric Algorithm)
  • Linear Spline, on arbitrary points
  • Cubic Spline, with boundary conditions on arbitrary points
  • Natural Cubic Spline, on arbitrary points
  • Akima Cubic Spline, on arbitrary points
  • Custom Barycentric Interpolation, based on provided barycentric weights
  • Custom Spline Interpolation, based on provided spline coefficients
  • Custom Cubic Hermite Spline Interpolation, based on provided derivatives

If unsure what to choose, we recommend to simply use Interpolate.Common(x,y) which internally uses the barycentric rational pole-free interpolation.

Code Sample

double[] t = new double[] { -2.0, -1.0, 0.0, 1.0, 2.0 };
double[] x = new double[] { 1.0, 2.0, -1.0, 0.0, 1.0 };
IInterpolation interp = Interpolate.RationalWithoutPoles(t, x);
double a = interp.Interpolate(-0.5);

Linear Algebra

Namespace: MathNet.Numerics.LinearAlgebra

  • Vector: Dense Real Double

Integral Transforms

Namespace: MathNet.Numerics.IntegralTransforms


The transformation behavior can be configured (scaling, exponent sign, etc). See here for more details and code samples around Fourier transforms.

Math.NET, a mathematical opensource .NET umbrella project by Christoph Rüegg and contributors.