Numerical Methods (47)

Root-finding, optimization, linear systems, and differential equations.

bfgs
BFGS quasi-Newton minimization (inverse-Hessian update + Armijo line search; analytic grad optional, else central differences; optional box bounds via projection); returns { x, fval, iterations, converged }
Syntax
bfgs(f, x0[, opts])
derivativeAt
Exact scalar derivative of f: ℝ → ℝ at x via forward-mode autodiff (the Dual type; no finite differences)
Syntax
derivativeAt(f, x)
differentialEvolution
Global minimization by differential evolution (rand/1/bin, F 0.8, CR 0.9, popSize 15·dim); deterministic for a given opts.seed (default 0); returns { x, fx, iterations, evaluations, converged }; empty or inverted bounds throw RangeError
Syntax
differentialEvolution(f, bounds[, opts])
eventDetection
ODE event detection
Syntax
eventDetection(...)
findRoot
Bracketed root-finding (bisection/Brent)
Syntax
findRoot(f, a, b[, opts])
finiteDifferenceCoefficients
Fornberg finite-difference weights for the derivOrder-th derivative at 0 on a stencil of offsets (in units of the step); e.g. (2, [-1, 0, 1]) is [1, -2, 1]
Syntax
finiteDifferenceCoefficients(derivOrder, offsets)
fixedPoint
Fixed point of g by iteration x ← g(x); opts.aitken: true applies Aitken Δ² extrapolation; opts.tol, opts.maxIter
Syntax
fixedPoint(g, x0[, opts])
fsolve
Nonlinear system solver F(x) = 0 for F: ℝⁿ → ℝⁿ (damped Newton)
Syntax
fsolve(F, x0[, opts])
gaussLegendre4
Listed in the export index; see the source for details.
Syntax
gaussLegendre4(…)
GL4ConvergenceError
Listed in the export index; see the source for details.
Syntax
GL4ConvergenceError(…)
globalMinimize
Global minimization
Syntax
globalMinimize(f, bounds[, opts])
gradient
Numeric gradient of sampled data (second-order central differences, one-sided at edges; matches numpy.gradient)
Syntax
gradient(y[, x])
gradientAt
Exact gradient of f: ℝⁿ → ℝ at x by n forward-mode passes
Syntax
gradientAt(f, x)
gradientDescent
Gradient descent with backtracking line search (analytic grad optional, else central differences); returns { x, fx, iterations, converged }
Syntax
gradientDescent(f, x0[, opts])
halley
Halley's method root-finding (cubic convergence)
Syntax
halley(f, x0[, opts])
hessian
Numeric Hessian (second partials) of f: ℝⁿ → ℝ via central differences, symmetric by construction
Syntax
hessian(f, x[, h])
interval
Construct an Interval [lo, hi]; throws if lo > hi
Syntax
interval(lo, hi)
leastSquares
Least-squares solution (normal equations, JS)
Syntax
leastSquares(A, b)
levenbergMarquardt
Levenberg–Marquardt nonlinear least squares (damped normal equations); opts.jacobian?: (x) => number[][] with J[i][j] = ∂r_i/∂x_j; default numericJacobian(residual, x, { h: 1e-7, scheme: 'forward' }); returns { x, residualNorm, iterations, converged }
Syntax
levenbergMarquardt(residual, x0[, opts])
linprog
Linear programming (legacy positional form); returns x
Syntax
linprog(c, A_ub, b_ub) linprog(c, { A_ub, b_ub, A_eq, b_eq, bounds })
lsqBounded
Box-constrained least squares (projected-gradient); returns { x, residual }
Syntax
lsqBounded(A, b, lower, upper[, opts])
maximize
Local maximization
Syntax
maximize(f, x0[, opts])
minimize
Local minimization
Syntax
minimize(f, x0[, opts])
minimizeConstrained
Augmented-Lagrangian minimization with a BFGS inner solver; opts.eq (h(x) = 0), opts.ineq (g(x) ≤ 0), opts.bounds, opts.tol (1e-8), opts.maxOuter (50); returns { x, fx, constraintViolation, outerIterations, converged }
Syntax
minimizeConstrained(f, x0[, opts])
minimizeScalar
1-D minimization via Brent's method (golden-section + parabolic interp)
Syntax
minimizeScalar(f[, opts])
nelderMead
Derivative-free downhill-simplex minimization; NelderMeadOptions.stepRule / tolRule default 'relative'; minimize is the 'absolute' wrapper and returns x only. Result { x, fx, iterations, converged }
Syntax
nelderMead(f, x0[, opts])
newton
Newton–Raphson root-finding (analytic or central-difference derivative)
Syntax
newton(f, x0[, opts])
nnls
Non-negative least squares (Lawson–Hanson active-set); returns { x, residual }
Syntax
nnls(A, b[, opts])
nullspace
Null-space basis
Syntax
nullspace(A)
numericJacobian
Numeric Jacobian of f: ℝⁿ → ℝᵐ (non-square OK) via central differences with a per-coordinate relative step; jacobian(f, x0) dispatches here when the first arg is a function
Syntax
numericJacobian(f, x0[, opts])
odeAdaptiveStep
Adaptive-step ODE integration
Syntax
odeAdaptiveStep(...)
propagateUncertainty
Listed in the export index; see the source for details.
Syntax
propagateUncertainty(…)
quadprog
Quadratic programming
Syntax
quadprog(Q, c, A, b[, opts])
residue
Partial-fraction residues
Syntax
residue(b, a)
ridders
Ridders' bracketed root-finding (opts.tol, opts.maxIter); f(a) and f(b) must differ in sign
Syntax
ridders(f, a, b[, opts])
root
Alias of fsolve
Syntax
root(F, x0[, opts])
secant
Secant-method root-finding (no derivative required)
Syntax
secant(f, x0, x1[, opts])
simulatedAnnealing
Seeded simulated annealing with opts.T0, opts.cooling and optional opts.bounds; same result shape as differentialEvolution
Syntax
simulatedAnnealing(f, x0[, opts])
solveBVP
Boundary value problem solver for a general first-order system y' = f(t,y) via single shooting; y0Guess (default [0, 0]) sets the state dimension n
Syntax
solveBVP(f, bc, mesh[, y0Guess])
solveDAE
Semi-explicit index-1 DAE y' = f(t,y,z), 0 = g(t,y,z) via variable-step BDF(1–2) with a coupled Newton solve for (y,z) each step; consistent-z0 solve; returns { t, y[t], z[t] } (higher-index input detected via singular ∂g/∂z)
Syntax
solveDAE(f, g, tspan, y0[, z0][, opts])
solveDDE
Constant-delay DDE y'(t) = f(t, y(t), [y(t−τ₁), …]) via the method of steps: adaptive BS23 + cubic-Hermite continuous extension (dense output), step capped at min(τ) so delayed args lie in computed history; lands on t0 + kτ breakpoints; history is φ(t) (or a constant), delays an array of positive τ; returns { t, y[t], yInterp }
Syntax
solveDDE(f, tspan, history, delays[, opts])
solveODE
ODE solver (factory layer)
Syntax
solveODE(f, tspan, y0[, opts])
solveODESystem
System of ODEs (RK, JS)
Syntax
solveODESystem(f, y0, tspan[, opts])
solveParabolicPDE
General 1-D parabolic PDE u_t = D(x)·u_xx + c(x)·u_x + f(x,t,u) via method-of-lines onto the BDF stiff solver; Dirichlet/Neumann BCs; returns { x, t, u[t][x] } (O(h²) in space)
Syntax
solveParabolicPDE({ diffusion, advection?, source?, x0, x1, T, nx, u0, bcLeft, bcRight, ... })
solvePDE
1-D heat-equation PDE solver (explicit Euler, fixed step; legacy)
Syntax
solvePDE(...)
stiffODESolver
Stiff-ODE solver
Syntax
stiffODESolver(...)
valueAndDerivativeAt
Value plus the exact forward-mode derivative of f at x; returns { value, deriv }
Syntax
valueAndDerivativeAt(f, x)