The OpenD Programming Language

mir.numeric

Base numeric algorithms.

Reworked part of std.numeric.

Members

Aliases

FindRootResult
alias FindRootResult = mir_find_root_result
FindRootStatus
alias FindRootStatus = mir_find_root_status

Enums

mir_find_root_status
enum mir_find_root_status

Functions

diff
DiffResult!T diff(T x, T h, T factor, T safe)
diffImpl
DiffResult!T diffImpl(T delegate(T) @(safe) pure nothrow @(nogc) f, T x, T h, T factor, T safe)

Calculate the derivative of a function. This function uses Ridders' method of extrapolating the results of finite difference formulas for consecutively smaller step sizes, with an improved stopping criterion described in the Numerical Recipes books by Press et al.

findLocalMin
FindLocalMinResult!T findLocalMin(T ax, T bx, T relTolerance, T absTolerance, size_t N)

Find a real minimum of a real function f(x) via bracketing. Given a function f and a range (ax .. bx), returns the value of x in the range which is closest to a minimum of f(x). f is never evaluted at the endpoints of ax and bx. If f(x) has more than one minimum in the range, one will be chosen arbitrarily. If f(x) returns NaN or -Infinity, (x, f(x), NaN) will be returned; otherwise, this algorithm is guaranteed to succeed.

findRoot
FindRootResult!T findRoot(T ax, T bx, T fax, T fbx, T lowerBound, T upperBound, uint maxIterations, uint steps)

Find root of a real function f(x) by bracketing, allowing the termination condition to be specified.

findRootImpl
FindRootResult!float findRootImpl(float ax, float bx, float fax, float fbx, float lowerBound, float upperBound, uint maxIterations, uint steps, float delegate(float) @(safe) pure nothrow @(nogc) f, bool delegate(float, float) @(safe) pure nothrow @(nogc) tolerance)
FindRootResult!double findRootImpl(double ax, double bx, double fax, double fbx, double lowerBound, double upperBound, uint maxIterations, uint steps, double delegate(double) @(safe) pure nothrow @(nogc) f, bool delegate(double, double) @(safe) pure nothrow @(nogc) tolerance)
FindRootResult!real findRootImpl(real ax, real bx, real fax, real fbx, real lowerBound, real upperBound, uint maxIterations, uint steps, real delegate(real) @(safe) pure nothrow @(nogc) f, bool delegate(real, real) @(safe) pure nothrow @(nogc) tolerance)

findRoot implementations.

findSmileRoots
FindSmileRootsResult!T findSmileRoots(T ax, T bx, T fax, T fbx, T relTolerance, T absTolerance, T lowerBound, T upperBound, uint maxIterations, uint steps)

Find one or two roots of a real function f(x) using combination of FindRoot and FindLocalMin.

integrate
T integrate(T a, T b, T tolerance)
integrateImpl
T integrateImpl(T delegate(T) @(safe) pure nothrow @(nogc) f, T a, T b, T tolerance)

Integrates function on the interval [a, b] using adaptive Gauss-Lobatto algorithm.

Structs

DiffResult
struct DiffResult(T)
FindLocalMinResult
struct FindLocalMinResult(T)
FindSmileRootsResult
struct FindSmileRootsResult(T)
SmileRoots
struct SmileRoots(T)

A set of one or two smile roots.

mir_find_root_result
struct mir_find_root_result(T)

Meta

Authors

Ilia Ki (API, findLocalMin, findRoot extension), Don Clugston (findRoot), Lars Tandle Kyllingstad (diff)