Numerical methods
- Bisection
- c = (a + b)/2, width after n steps (b − a)/2ⁿ
- Newton–Raphson
- xn+1 = xₙ − f(xₙ)/f′(xₙ)
- Linear interpolation
- y = y₁ + (y₂ − y₁)(x − x₁)/(x₂ − x₁)
- Trapezoid rule
- T = (h/2)[f₀ + 2f₁ + … + 2fn−1 + fₙ], h = (b − a)/n
- Simpson’s rule (n even)
- S = (h/3)[f₀ + 4f₁ + 2f₂ + … + 4fn−1 + fₙ]
- Trapezoid error bound
- |E| ≤ (b − a)h²M/12, M = max|f″|
- Euler
- yn+1 = yₙ + h·f(tₙ, yₙ)
- Heun
- yn+1 = yₙ + (h/2)(k₁ + k₂), k₂ = f(tₙ + h, yₙ + hk₁)
- RK4
- yn+1 = yₙ + (h/6)(k₁ + 2k₂ + 2k₃ + k₄)
Method
- For a root: check the sign change for bisection, or compute f and f′ for Newton, and keep six or more digits in a table of iterates.
- For a table value: interpolate linearly between the two neighbouring points.
- For an integral: find h = (b − a)/n, list f at every node, apply the weights (1, 2, …, 2, 1 for trapezoid; 1, 4, 2, …, 4, 1 for Simpson with even n) and multiply by h/2 or h/3.
- For an ODE: step from t₀ with yₙ₊₁ = yₙ + h·f(tₙ, yₙ) (Euler) or the averaged slope (Heun), one row per step, until you reach the requested t.