Knowledge / Mathematics / Numerical methods

Numerical methods

Mathematics (B.Sc) · More core mathematics · free study notes for exams, placements and interviews

In short

Numerical methods replace exact algebra by finite, repeatable arithmetic: a root is reached by iteration, an integral by a weighted sum of ordinates, a differential equation by stepping forward in small increments. They exist because most equations met in practice — transcendental equations, large linear systems, integrals with no closed form, non-linear ODEs — have no analytic solution. In a B.Sc (CBCS) course the topic carries a full paper plus a practical lab in C/Python/Scilab; it is examined in GATE MA (and in GATE CS/ME as "numerical methods"), CSIR-UGC NET, IIT JAM-based M.Sc entrances and in state PSC technical papers. In jobs it is the mathematics underneath every simulation and analytics product — FEA/CFD at Ansys, Altair, Siemens and L&T, trajectory and orbit computation at ISRO and DRDO, weather models at IMD/NCMRWF, pricing and risk engines at banks and actuarial firms, and SciPy/NumPy/MATLAB work in any data-science role.

Explained

Errors, significant digits and conditioning

Roots of algebraic and transcendental equations

Finite differences, interpolation and curve fitting

Numerical differentiation and integration

Systems of linear equations and eigenvalues

Ordinary differential equations and initial-value problems

Key points

Formulas and examples

Absolute error Ea = |x − x̄|; Relative error Er = Ea/|x|; correct to n significant digits if Er ≤ 0.5 × 101−n
Bisection: x_m = (a+b)/2; iterations for tolerance ε: n ≥ log₂((b−a)/ε)
Regula falsi: x = a − f(a)(b−a)/(f(b)−f(a))
Newton–Raphson: x_(n+1) = x_n − f(x_n)/f′(x_n)
Secant: x_(n+1) = x_n − f(x_n)(x_n − x_(n−1))/(f(x_n) − f(x_(n−1)))
Newton forward: y(x₀+ph) = y₀ + pΔy₀ + p(p−1)Δ²y₀/2! + p(p−1)(p−2)Δ³y₀/3! + …, p = (x−x₀)/h
Lagrange: f(x) = Σ_i y_i Π_(j≠i) (x−x_j)/(x_i−x_j)
Central difference: f′(x) ≈ [f(x+h) − f(x−h)]/2h; f″(x) ≈ [f(x+h) − 2f(x) + f(x−h)]/h²
Trapezoidal: ∫ ≈ (h/2)[y₀ + y_n + 2(y₁+y₂+…+y_(n−1))]; error = −(b−a)h²f″(ξ)/12
Simpson's 1/3: ∫ ≈ (h/3)[y₀ + y_n + 4(odd ordinates) + 2(even ordinates)]; error = −(b−a)h⁴f⁗(ξ)/180
Simpson's 3/8: ∫ ≈ (3h/8)[y₀ + y_n + 3(y₁+y₂+y₄+y₅+…) + 2(y₃+y₆+…)]
Two-point Gauss–Legendre: ∫₋₁¹ f(t)dt ≈ f(−1/√3) + f(1/√3); map x = (a+b)/2 + (b−a)t/2, dx = (b−a)dt/2
Gauss–Seidel (ith equation): x_ik+1 = [b_i − Σ_(j<i) a_ij x_jk+1 − Σ_(j>i) a_ij x_jk]/a_ii
Euler: y_(n+1) = y_n + h f(x_n, y_n)
RK4: k₁ = hf(x_n,y_n); k₂ = hf(x_n+h/2, y_n+k₁/2); k₃ = hf(x_n+h/2, y_n+k₂/2); k₄ = hf(x_n+h, y_n+k₃); y_(n+1) = y_n + (k₁+2k₂+2k₃+k₄)/6
Least squares line y = a + bx: b = (nΣxy − ΣxΣy)/(nΣx² − (Σx)²), a = (Σy − bΣx)/n

Symbols: h = step size or tabular interval (same units as x); n = number of subintervals or data points; p = interpolation parameter (dimensionless); ξ = some point in the interval; errors carry the units of the quantity computed.

Example 1 — Newton–Raphson for x³ − 2x − 5 = 0, x₀ = 2.

Example 2 — ∫₀¹ dx/(1+x²) with h = 0.25 (true value π/4 = 0.78539816). Ordinates: y₀ = 1, y₁ = 0.9411765, y₂ = 0.8, y₃ = 0.64, y₄ = 0.5.

RuleFitsIntervals neededError orderValue above
Trapezoidalstraight lineany nO(h²)0.7827941
Simpson 1/3parabolan evenO(h⁴)0.7853922
Simpson 3/8cubicn multiple of 3O(h⁴)—
2-pt Gaussexact to degree 32 nodes—0.7868 (approx)

Example 3 — Newton's forward difference interpolation. Table x = 1, 2, 3, 4 with y = 1, 8, 27, 64. Differences: Δy = 7, 19, 37; Δ²y = 12, 18; Δ³y = 6. Estimate y(1.5): p = (1.5 − 1)/1 = 0.5. y = 1 + 0.5(7) + [0.5(−0.5)/2](12) + [0.5(−0.5)(−1.5)/6](6) = 1 + 3.5 − 1.5 + 0.375 = 3.375. Exact 1.5³ = 3.375 — a cubic is reproduced exactly because the third differences are constant and the fourth vanish.

Example 4 — Gauss–Seidel, 20x + y − 2z = 17, 3x + 20y − z = −18, 2x − 3y + 20z = 25. Each row is strictly diagonally dominant (20 > 1+2, 20 > 3+1, 20 > 2+3), so convergence is assured. Starting from (0, 0, 0):

Iterationxyz
10.850000−1.0275001.010875
21.002463−0.9998260.999780
30.999969−1.0000061.000002

Round 1: x = (17 − 0 + 0)/20 = 0.85; y = (−18 − 3(0.85) + 0)/20 = −1.0275; z = (25 − 2(0.85) + 3(−1.0275))/20 = 1.010875. Three sweeps give x = 1, y = −1, z = 1 to four decimals.

Example 5 — RK4 for dy/dx = x + y, y(0) = 1, h = 0.1.

# RK4 in four lines (NumPy/SciPy style used in labs and industry)
def rk4(f, x, y, h, n):
    for _ in range(n):
        k1 = h*f(x, y);        k2 = h*f(x+h/2, y+k1/2)
        k3 = h*f(x+h/2, y+k2/2); k4 = h*f(x+h, y+k3)
        y += (k1 + 2*k2 + 2*k3 + k4)/6; x += h
    return y

Where it is used

Interview questions

Common mistakes

Related topics

Open in the Knowledge reader →Find jobs →