Numerical Analysis - Step-by-Step Examples & Revision Sheet
1. Bisection Method
Function: f(x) = x^3 - x - 2
Step 1: Choose interval [a=1, b=2] such that f(a)*f(b) < 0
f(1) = -2, f(2) = 4 --> signs differ, continue
Step 2: Compute midpoint m = (1+2)/2 = 1.5
f(1.5) = 1.5^3 - 1.5 - 2 = -0.125
Step 3: f(1)*f(1.5) = -2*(-0.125) > 0 root lies in [1.5, 2]
Repeat until desired accuracy.
2. Newton-Raphson Method
Function: f(x) = x^2 - 2, f'(x) = 2x
Initial guess: x0 = 1
x1 = x0 - f(x0)/f'(x0) = 1 - (1^2 - 2)/(2*1) = 1.5
x2 = 1.5 - (1.5^2 - 2)/(2*1.5) = 1.4167 ...
Continue iterations until convergence.
3. Lagrange Interpolation
Given points: (1, 2), (3, 6), (4, 5)
Numerical Analysis - Step-by-Step Examples & Revision Sheet
L0(x) = [(x-3)(x-4)] / [(1-3)(1-4)] = (x-3)(x-4)/6
L1(x) = [(x-1)(x-4)] / [(3-1)(3-4)] = -(x-1)(x-4)/2
L2(x) = [(x-1)(x-3)] / [(4-1)(4-3)] = (x-1)(x-3)/3
f(x) = 2*L0 + 6*L1 + 5*L2
4. Trapezoidal Rule
Approximate 01 x2 dx
f(x) = x2, a = 0, b = 1, h = 1
T h/2 [f(0) + f(1)] = 1/2 * [0 + 1] = 0.5
5. Simpson's 1/3 Rule
Approximate 02 x2 dx
f(x) = x2, a = 0, b = 2, h = 1
S h/3 [f(0) + 4f(1) + f(2)] = 1/3 * [0 + 4*1 + 4] = 2.67
6. Euler's Method
Numerical Analysis - Step-by-Step Examples & Revision Sheet
dy/dx = x + y, y(0) = 1, h = 0.1
y1 = y0 + h*f(x0, y0) = 1 + 0.1*(0+1) = 1.1
y2 = 1.1 + 0.1*(0.1 + 1.1) = 1.22
Repeat for more steps.
7. Runge-Kutta 4th Order Method
dy/dx = x + y, y(0) = 1, h = 0.1
k1 = h*f(x0, y0)
k2 = h*f(x0 + h/2, y0 + k1/2)
k3 = h*f(x0 + h/2, y0 + k2/2)
k4 = h*f(x0 + h, y0 + k3)
y1 = y0 + 1/6*(k1 + 2k2 + 2k3 + k4)