mathlib — Numerical

Root-finding, quadrature, numerical differentiation, ODE solvers. ← Back to hub

Root-finding

1 Roots of f(x) = 0

Bisection, Newton, secant, and Brent's method.

Method:

f(x) on [a,b]; dot = found root.
—
Quadrature

2 Deterministic integration

Trapezoidal, Simpson, and Gauss–Legendre rules.

Rule: n:

f(x) on [a,b]; shaded = approximate integral.
—
Differentiation

3 Numerical derivative

Central finite difference: f'(x) ≈ (f(x+h) - f(x-h)) / (2h).

h: x range: [, ]

f(x) (blue) and f'(x) via finite diff (orange).
—
ODE

4 ODE solvers: Euler vs RK4

dy/dt = f(t,y). Compare Forward Euler and RK4.

dt: steps:

y(t): Euler (blue), RK4 (orange), exact if known (dashed).
—