Numerical Methods - Sample Problems with
Solutions
Problem 1: Root-Finding using Bisection
Find a root of f(x) = x^3 − 4x − 9 in the interval [2, 3] using the Bisection Method until the interval
half-width is less than 1e-5.
Approximate root ≈ 2.706528. Iterations: 16.
Iter a b c f(c) half-width
1 2.000000 3.000000 2.500000 -3.375000 5.000000e-01
2 2.500000 3.000000 2.750000 0.796875 2.500000e-01
3 2.500000 2.750000 2.625000 -1.412109 1.250000e-01
4 2.625000 2.750000 2.687500 -0.339111 6.250000e-02
5 2.687500 2.750000 2.718750 0.220917 3.125000e-02
6 2.687500 2.718750 2.703125 -0.061077 1.562500e-02
Problem 2: Root-Finding using Newton–Raphson
Solve cos(x) − x = 0 using Newton–Raphson starting at x■ = 0.5.
Approximate root ≈ 0.7390851332 (iterations: 4).
Iter x f(x)
0 0.5000000000 3.776e-01
1 0.7552224171 -2.710e-02
2 0.7391416661 -9.462e-05
3 0.7390851339 -1.181e-09
4 0.7390851332 0.000e+00
Problem 3: Polynomial Interpolation (Lagrange)
Given points (0,1), (1,2), (2,0), estimate f(1.5) using the Lagrange interpolation polynomial.
Estimated f(1.5) ≈ 1.375000.
Problem 4: Numerical Differentiation (Forward Difference)
Approximate f′(1) for f(x) = e^x using forward difference with h = 0.1.
Approx f′(1) ≈ 2.858842; True f′(1) = e ≈ 2.718282; Absolute error ≈ 1.41e-01.
Problem 5: Numerical Integration (Trapezoidal & Simpson’s)
Approximate I = ∫■^π sin(x) dx using (a) Trapezoidal rule with n=10 and (b) Simpson’s rule with
n=10.
Trapezoidal ≈ 1.98352354 (error ≈ 1.65e-02); Simpson’s ≈ 2.00010952 (error ≈ 1.10e-04).
Problem 6: Solving ODE y′ = −2y, y(0)=1 (Euler and RK4)
Compute y(1) using step size h = 0.5 with (a) Euler’s method and (b) Classical 4th-order
Runge–Kutta (RK4).
Euler y(1) ≈ 0.00000000; RK4 y(1) ≈ 0.14062500; True y(1) = e^(−2) ≈ 0.13533528.
Euler path:
x y
0.00 1.00000000
0.50 0.00000000
1.00 0.00000000
RK4 path:
x y
0.00 1.00000000
0.50 0.37500000
1.00 0.14062500