COMPILATION OF
NUMERICAL PROBLEMS
WITH SOLUTIONS
(FINAL TERM)
MARK JOSEPH ADRIANE N. LARIOQUE
BSCE-3B
CONTENTS
1. NUMERICAL DIFFERENTIATION
- FINITE DIFFERENCES
❖ Forward
❖ Backward
❖ Central
2. NUMERICAL INTEGRATION
❖ Trapezoidal
❖ Simpson’s Rule
❖ Simpson’s Rule
3. SOLUTIONS OF ODE: INITIAL VALUE PROBLEMS
❖ Eulers Explicit Method
❖ Modified Eulers Method, Midpoint Method
❖ Runge-Kutta (2nd, 3rd and 4th Order Methods)
❖ Modified Eulers Predictor Corrector Method
4. SOLUTIONS OF ODE: BOUNDARY VALUE
PROBLEMS
❖ Shooting Method
❖ Finite-Difference Method
1. NUMERICAL
DIFFERENTIATION
- Finite Differences
1. Estimate the first derivative using forward, backward, and centered finite
differences of the function 𝑓(𝑥) = 3𝑥2 + 2𝑥 − 3 at x = 1.5 using a step
size h = 0.5
f(x1-2) = 0.5 f (0.5) = -3.75
f(x1-1) = 1 f (1) = -3
f(x1) = 1.5 f (1.5) = -0.75
f(x1+1) = 2 f (2) = 3
f(x1+2) = 2.5 f (2.5) = 8.25
FORWARD BACKWARD CENTRAL
𝑓(𝑥 −1)−𝑓(𝑥1 ) 𝑓(𝑥 )−𝑓(𝑥 −1) 𝑓(𝑥 +1)−𝑓(𝑥1 −1)
f’(x)= 1 ℎ f’(x)= 1 ℎ 1 f’(x)= 1 2ℎ
−3 − (−0.75) −0.75 − (−3) 3 − (−3)
0.5 0.5 0.5
= -4.5 = 4.5 = 12
2. Estimate the first derivative using forward, backward, and centered finite
differences of the function 𝑓(𝑥) = 4𝑥2 + 2𝑥 − 6 at x = 1.5 using a step
size h = 0.5
f(x1-2) = 0.5 f (0.5) = -4
f(x1-1) = 1 f (1) = 0
f(x1) = 1.5 f (1.5) = 6
f(x1+1) = 2 f (2) = 14
f(x1+2) = 2.5 f (2.5) = 24
FORWARD BACKWARD CENTRAL
𝑓(𝑥 −1)−𝑓(𝑥1 ) 𝑓(𝑥 )−𝑓(𝑥 −1) 𝑓(𝑥1 +1)−𝑓(𝑥1 −1)
f’(x)= 1 ℎ f’(x)= 1 ℎ 1 f’(x)= 2ℎ
14 − 6 6=0 14 − 0
0.5 0.5 0.5
= 16 = 12 = 14
2. NUMERICAL INTEGRATION
❖ Trapezoidal
1. Evaluate the integral of 𝑓(𝑥) = 2x2+3x+5 from x=0 to x= 2 using
trapezoidal rule subdivided into 4 equal parts.
𝑥0 +𝑛ℎ
ℎ
∫ 𝑓(𝑥)𝑑𝑥 = [(𝑦 + 𝑦𝑛 ) + 𝑦1 + 𝑦2 + ⋯ 𝑦𝑛 )]
𝑥0 2 0
2−0 2
h=
4
= 0.5 ∫0 2𝑥 2 + 3𝑥 + 5𝑑𝑥= 21.33
ℎ
x f(x) [(𝑦0 + 𝑦𝑛 ) + 𝑦1 + 𝑦2 + ⋯ 𝑦𝑛 )
2
0.5
0 5 y0 [(5 + 19) + 7 + 10 + 14 + 19]
2
0.5 7 y1 = 18.5
1 10 y2
1.5 14 y3
2 19 y4
2. Evaluate the integral of 𝑓(𝑥) = x2+4x+1 from x=0 to x=3 using
trapezoidal rule subdivided into 6 equal parts.
𝑥0 +𝑛ℎ
ℎ
∫ 𝑓(𝑥)𝑑𝑥 = [(𝑦 + 𝑦𝑛 ) + 𝑦1 + 𝑦2 + ⋯ 𝑦𝑛 )]
𝑥0 2 0
3−0 3
h=
6
= 0.5 ∫0 𝑥 2 + 4𝑥 + 1𝑑𝑥 = 30
ℎ
[(𝑦0 + 𝑦𝑛 ) + 𝑦1 + 𝑦2 + ⋯ 𝑦𝑛 )]
2
x f(x)
0.5
0 1 y0 [(1 + 22) + 3.25 + 6 + 9.25 + ⋯ + 22]
2
0.5 3.25 y1 = 23.4375
1 6 y2
1.5 9.25 y3
2 13 y4
2.5 17.25 y5
3 22 y6
1
❖ Simpson’s 3 Rule
1. Estimate the integral of the function 𝑓(𝑥) = x2+4x+1 from x=0 to
1
x=3 using Simpson’s Rule where n=6.
3
𝑥0 +𝑛ℎ
ℎ
∫ 𝑓(𝑥)𝑑𝑥 = [(𝑦 + 𝑦𝑛 ) + 4(𝑦1 + 𝑦3 … + 𝑦𝑛−1 ) + 2(𝑦2 + 𝑦4 + ⋯ + 𝑦𝑛=2 )]
𝑥0 3 0
x f(x) 3−0 3
h=
6
= 0.5 ∫0 𝑥 2 + 4𝑥 + 1𝑑𝑥 = 30
0 1 y0
0.5 3.25 y1 ℎ
3
[(𝑦0 + 𝑦𝑛 ) + 4(𝑦1 + 𝑦3 … + 𝑦𝑛−1 ) + 2(𝑦2 + 𝑦4 + ⋯ + 𝑦𝑛−2 )]
1 6 y2
0.5
1.5 9.25 y3 [(1 + 22) + 4(3.25 + 9.25 + 17.25) + 2(6 + 13)]
3
2 13 y4 = 30
2.5 17.25 y5
3 22 y6
2. Approximate the definite integral of 𝑓(𝑥) = x3 from 0 to 2 using
1
Simpson’s Rule (n=4).
3
𝑥0 +𝑛ℎ
ℎ
∫ 𝑓(𝑥)𝑑𝑥 = [(𝑦 + 𝑦𝑛 ) + 4(𝑦1 + 𝑦3 … + 𝑦𝑛−1 ) + 2(𝑦2 + 𝑦4 + ⋯ + 𝑦𝑛=2 )]
𝑥0 3 0
2−0 2
x f(x) h= = 0.5 ∫0 𝑥 3 𝑑𝑥 = 4
4
0 0 y0
ℎ
[(𝑦0 + 𝑦𝑛 ) + 4(𝑦1 + 𝑦3 … + 𝑦𝑛−1 ) + 2(𝑦2 + 𝑦4 + ⋯ + 𝑦𝑛−2 )]
0.5 0.125 y1 3
0.5
1 1 y2 3
[(0 + 8) + 4(0.125 + 3.375) + 2(1)]
1.5 3.375 y3
=4
2 8 y4
3
❖ Simpson’s 8 Rule
1 1 3
1. Evaluate the integral ∫0 𝑑𝑥 using Simpson’s Rule (n=6).
1+𝑥 3 8
𝑥0 +𝑛ℎ
3ℎ
∫ 𝑓(𝑥)𝑑𝑥 = [(𝑦0 + 𝑦𝑛 ) + 3(𝑦1 + 𝑦2 + 𝑦4 + 𝑦5 + ⋯ + 𝑦𝑛−2 + 𝑦𝑛−1 )
𝑥0 8
+ 2(𝑦3 + 𝑦6 + ⋯ + 𝑦𝑛−3 )]
x f(x) 1−0 1 1 1
h= = ∫0 𝑑𝑥 = 0.8356
0 1 y0 6 6 1+𝑥 3
1/6 0.9954 y1 𝑥0 +𝑛ℎ
3ℎ
∫ 𝑓(𝑥)𝑑𝑥 = [(𝑦0 + 𝑦𝑛 ) + 3(𝑦1 + 𝑦2 + 𝑦4 + 𝑦5 + ⋯ + 𝑦𝑛−2 + 𝑦𝑛−1 )
8
1/3 0.9643 y2 𝑥0
+ 2(𝑦3 + 𝑦6 + ⋯ + 𝑦𝑛−3 )]
1/2 0.8889 y3 3( )
1
6
[(1 + 0.5) + 3(0.9954 + 0.9643 + 0.7714 + 0.6334) + 2(0.8889)]
8
2/3 0.7714 y4
= 0.8357
5/6 0.6334 y5
1 0.5 y6
4 3
2. Evaluate the integral ∫1 𝑒 𝑥+1 𝑑𝑥 using Simpson’s Rule (n=6).
8
𝑥0 +𝑛ℎ
3ℎ
∫ 𝑓(𝑥)𝑑𝑥 = [(𝑦0 + 𝑦𝑛 ) + 3(𝑦1 + 𝑦2 + 𝑦4 + 𝑦5 + ⋯ + 𝑦𝑛−2 + 𝑦𝑛−1 )
𝑥0 8
+ 2(𝑦3 + 𝑦6 + ⋯ + 𝑦𝑛−3 )]
4−1 4
h= = 0.5 ∫1 𝑒 𝑥+1 𝑑𝑥 = 141.024
x f(x) 6
1 7.389 y0
1.5 12.182 y1 𝑥0 +𝑛ℎ
3ℎ
∫ 𝑓(𝑥)𝑑𝑥 = [(𝑦0 + 𝑦𝑛 ) + 3(𝑦1 + 𝑦2 + 𝑦4 + 𝑦5 + ⋯ + 𝑦𝑛−2 + 𝑦𝑛−1 )
𝑥0 8
2 20.086 y2 + 2(𝑦3 + 𝑦6 + ⋯ + 𝑦𝑛−3 )]
2.5 33.115 y3
3(0.5)
3 54.598 y4 [(7.389 + 148.413) + 3(12.182 +
8
3.5 90.017 y5 20.086 + 54.598 + 90.017) + 2(33.115)]
4 148.413 y6 = 141.128
3. SOLUTIONS OF ODE: INITIAL VALUE
PROBLEMS
❖ Euler’s Explicit Method
1. Using Euler’s Method, find an approximate value of y
𝑑𝑦
corresponding to x = 0.4, given that = 𝑥 2 + 𝑦, and y = 1 when
𝑑𝑥
x= 0, in 4 steps.
0.4
h= = 0.1 h=0.1 𝑥0 =0, 𝑦0 =1, 𝑓 (𝑥, 𝑦) = 𝑥 2 + 𝑦
4
we have 𝑦𝑖+1 = 𝑦𝑖 + 𝑓(𝑥𝑖, 𝑦𝑖 )ℎ
𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 𝑦0 ) = 𝑦1 = 1+(0.1) [(02) +1] = 1.1
𝑦2 = 𝑦1 + ℎ𝑓(𝑥1 , 𝑦1 ) = 𝑦2 = 1.1+(0.1) (0.12+1.1) = 2.201
𝑦3 = 𝑦2 + ℎ𝑓(𝑥2 , 𝑦2 ) = 𝑦3 = 2.201 + (0.1) (0.22+2.201) = 2.425
𝑦4 = 𝑦3 + ℎ𝑓(𝑥3 , 𝑦3 ) = 𝑦4 = 2.425 + (0.1) (0.32+ 2.425) = 2.677
Hence for x=0.4, y= 2.677
2. Using Euler’s Method, find an approximate value of y given that
𝑓(𝑥, 𝑦) = −2𝑦 + 3𝑥 and y = 3 when x= 1, having a step size of 1.
h= 1 𝑥0 =1, 𝑦0 =3, 𝑓 (𝑥, 𝑦) = 𝑥 2 + 𝑦
we have 𝑦𝑖+1 = 𝑦𝑖 + 𝑓(𝑥𝑖, 𝑦𝑖 )ℎ
𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 𝑦0 ) = 𝑦1 = 3 + 1[−2(3) + 3(1)] = 0
𝑦2 = 𝑦1 + ℎ𝑓(𝑥1 , 𝑦1 ) = 𝑦2 = 0 + 1[−2(0) + 3(2)] = 6
𝑦3 = 𝑦2 + ℎ𝑓(𝑥2 , 𝑦2 ) = 𝑦3 = 6 + 1[−2(6) + 3(3)] = 3
𝑦4 = 𝑦3 + ℎ𝑓(𝑥3 , 𝑦3 ) = 𝑦4 = 3 + 1[−2(3) + 3(4)] = 9
𝑦5 = 𝑦4 + ℎ𝑓(𝑥4 , 𝑦4 ) = 𝑦5 = 9 + 1[−2(9) + 3(5)] = 6
Hence y = 6.
❖ Modified Euler’s Method, Midpoint Method
1. Find y (2.2) using Euler’s Modified Method for 𝑑𝑦
𝑑𝑥
= 𝑥𝑦 2 , where
y (1) =2, take h= 0.05.
x + h = 1+0.05 = 1.05
y1(0) = 𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 𝑦0 ) = 2+0.05(1)(2)2 = 2.2
ℎ
y1(1) = y0 + [𝑓(𝑥0, 𝑦0 ) + 𝑓(𝑥1, 𝑦1 )
2
(1) 0.05
y1 = 2 + [1(22 ) + (1.05)(2.22 )] = 2.22705
2
0.05
y1(2) = 2 + [1(22 ) + (1.05)(2.227052 )] = 2.23019
2
0.05
y1(3) = 2 + [1(22 ) + (1.05)(2.230192 )] = 2.23056
2
0.05
y1(4) = 2 + [1(22 ) + (1.05)(2.230562 )] = 2.23060
2
0.05
y1(5) = 2 + [1(22 ) + (1.05)(2.230602 )] = 2.23061
2
since y1(4) + y1(5) = 2.2306, correct to 4 decimal places. Hence take
y1= 2.2306 at x1= 1.05 now if y2 is the value of y at x= 1.06
y2(0) = y2 = y1 + hf (x1, y1) = 2.2306 +0.05(1)(22) = 2.24306
0.05
y2(1) = 2.2306 + [(1.05)(2.2306) + (1.06)(2. 22 )] = 2.22705
2
0.05
y2(2) = 2.2306 + [(1.05)(2.2306) + (1.06)(2.22705)] = 2.23019
2
0.05
y2(3) = 2.2306 + [(1.05)(2.2306) + (1.06)(2.23019)] = 2.23056
2
0.05
y2(4) = 2.2306 + [(1.05)(2.2306) + (1.06)(2.23056)] = 2.23060
2
0.05
y2(5) = 2.2306 + [(1.05)(2.2306) + (1.06)(2.23060)] = 2.23061
2
since y2(4) = y2(5) = 2.2306 correct to 4 decimal places.
Hence y(1.06) = 2.2306
2. Find y (2.2) using Euler’s Modified Method for 𝑑𝑦
𝑑𝑥
= 𝑥𝑦, where y
(2) =1, take h= 0.1.
x + h = 2 + 0.1 = 2.1
y1(0) = 𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 𝑦0 ) = 1+ 0.1(2)(1) =1.2
ℎ
y1(1) = y0 + [𝑓(𝑥0, 𝑦0 ) + 𝑓(𝑥1, 𝑦1 )
2
(1) 0.1
y1 = 1+ [2(1) + (2.1)(1.2)] = 1.226
2
0.1
y1(2) = 1+ [2(1) + (2.1)(1.226)] = 1.22873
2
0.1
y1(3) = 1+ [2(1) + (2.1)(1.22873)] = 1.22902
2
0.1
y1(4) = 1+ [2(1) + (2.1)(1.22902)] = 1.22905
2
0.1
y1(5) = 1+ [2(1) + (2.1)(1.22905)] = 1.22905
2
since y1(4) + y1(5) = 1.22905, take y1= 1.22905 at x1= 2.1
now if y2 is the value of y at x= 2.2
y2(0) = y2 = y1 + hf (x1, y1) = 1.22905 +0.1(2)(1) = 1.42905
0.1
y2(1) = 1.22905 + [(2.1)(1.22905) + (2.2)(1.42905)] = 1.5153
2
(2) 0.1
y2 = 1.22905 + [(2.1)(1.22905) + (2.2)(1.5153)] = 1.52478
2
0.1
y2(3) = 1.22905 + [(2.1)(1.22905) + (2.2)(1.52478)] = 1.52583
2
0.1
y2(4) = 1.22905 + [(2.1)(1.22905) + (2.2)(1.52583)] = 1.52594
2
0.1
y2(5) = 1.22905 + [(2.1)(1.22905) + (2.2)(1.52594)] = 1.52595
2
since y2(4) = y2(5) = 1.5259 correct to 4 decimal places.
Hence y(2.2) = 1.5259
❖ Runge-Kutta (2nd, 3rd, and 4th Order Methods)
1. Find the approximate value of y when x= 0.5 for the particular
𝑑𝑦 2𝑥 2
solution = satisfying y=1, x=0.25 using Runge-Kutta
𝑑𝑥 𝑦
Method.
2𝑥 2
h= 0.5 - 0.25 = 0.25, 𝑥0 = 0.25, 𝑦𝑜 = 1, 𝑓(𝑥, 𝑦) =
𝑦
2(0.25)2
𝑘1 = ℎ𝑓(𝑥0 , 𝑦0 ), =0.25 [ ] = 0.03125
1
0.25
ℎ 𝑘1 2(0.25)2 +
𝑘2 = ℎ𝑓(𝑥0 + , 𝑦0 + ), =0.25 [ 0.03125
2
] = 0.06154
2 2 1+
2
0.25
ℎ 𝑘2 2(0.25)2 +
𝑘3 = ℎ𝑓(𝑥0 + , 𝑦0 + ), =0.25 [ 0.06154
2
] = 0.06063
2 2 1+
2
0.25
2(0.25)2 +
𝑘4 = ℎ𝑓(𝑥0 + ℎ, 𝑦0 + 𝑘3 ), =0.25 [ 0.06063
2
] = 0.08839
1+
2
Hence the required value for y is:
1
𝑦 = 𝑦0 + (𝑘1 + 𝑘4 + 2(𝑘2 + 𝑘3 )
6
1
𝑦 = 1 + (0.03125 + 0.08839 + 2(0.06154 + 0.06063)
6
𝑦 = 1.06514
𝑑𝑦
2. Solve the differential equation = 𝑥 + 𝑦 with initial condition
𝑑𝑥
𝑦0 = 1 using Runge-Kutta Methods of 2nd, 3rd, and 4th order. Find
y(0.2). h= 0.2
2nd Order
𝑓(𝑥0 , 𝑦0 ) = 0 + 1 = 1
ℎ
(𝑥0 + 2) = 0 + 0.1 = 0.1
ℎ
(𝑦0 + 2) (𝑓(𝑥0 , 𝑦0 )) = 1 + 0.1(1) = 1.1
ℎ ℎ
𝑓 ((𝑥0 + ), (𝑦0 + )) (𝑓(𝑥0 , 𝑦0 )) = 0.1 + 1.1 = 1.2
2 2
𝑦1 = 1 + 0.2(1.20) = 1.24
3rd Order
𝑘1 = 1
𝑘2 = 𝑓(0.1,1.1) = 0.1 + 1.1 = 1.2
𝑘3 = 𝑓(0.2,1.24) = 0.2 + 1.24 = 1.44
𝑦1 = 1 + (0.216)[(1 + 4)(1.2)(1.44)] = 1.248
4th Order
𝑘1 = 1
𝑘2 = 𝑓(0.1,1.1) = 0.1 + 1.1 = 1.2
𝑘3 = 𝑓(0.2,1.12) = 1.22
𝑘4 = 𝑓(0.2,1.244) = 1.44
0.2
𝑦1 = 1 + ( )(1 + 21.2 + 21.22 + 1.494)
6
𝑦1 = 1.24687
❖ Modified Euler’s Predictor Corrector Method
𝑑𝑦
1. Solve the differential equation = 2𝑥 2 + 𝑦 with initial condition 𝑦0 = 0,
𝑑𝑥
step size of 0.1 using Modified Euler’s Predictor Corrector Method, find
y(0.1)
Given Data
𝑑𝑦
1. = 2𝑥 2 + 𝑦
𝑑𝑥
2. Initial Condition = 𝑦0 = 0
3. h= 0.1
4. 𝑥0 = 0
Predictor Step
𝑦1 = 𝑦0 + ℎ[𝑓(𝑥0 , 𝑦0 )]
𝑓(𝑥0 , 𝑦0 ) = 2(02 ) + 0 = 0
𝑦1 = 0 + 0.1(0) = 0
Corrector Step
ℎ
𝑦1 = 𝑦0 + [𝑓(𝑥0 𝑦𝑜 ) + 𝑓(𝑥1 , 𝑦1 )]
2
𝑓(𝑥𝑖 , 𝑦1 ) = 2(0.1)2 + 0 = 0.02
0.1
𝑦1 = 0 + [(0 + 0.02)] = 0.001
2
𝑑𝑦
2. Solve = 𝑥 + 2𝑦 , y(0) = 1, at x = 0.2 , h = 0.1
𝑑𝑥
y10 = 𝑦0 + 𝑓(𝑥0 , 𝑦0 )
= 2+0.1[0+2(2)]
= 2.4
ℎ
y1 = 𝑦0 + [𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 )]
2
0.1
2+ [0 + 2(2) + (0.1 + 2(2.4))] = 2.445
2
y20 = y1 +ℎ𝑓(𝑥1 , 𝑦1 )
= 2.445 +0.1(0.1+2(2.445)) = 2.944
ℎ
y2 = y1+ [𝑓(𝑥1 , 𝑦1 ) + 𝑓(𝑥2 , 𝑦2 )]
2
0.1
= 2.445 + [0.1 + 2(2.445) + 0.2 + 2(2.944)
2
y(0.2) = 2.9989
4. SOLUTIONS OF ODE: BOUNDARY VALUE
PROBLEMS
❖ Shooting Method
1. Find the solution of the given differential equation
boundary value problem y’’= y, y(0)=0;
y(1)=1.1752
Assume y(x)= 𝑦0 (𝑥) + 𝑘1 𝑦1 (𝑥) + 𝑘2 𝑦2 + ⋯
Where 𝑦0 are the solution of the given differential solution.
𝑦0′′ − 𝑦0 = 0 𝑦0 (0) = 0; 𝑦0′ (0) = 0
𝑦1′′ − 𝑦1 = 0 𝑦1 (0) = 1; 𝑦1′ (0) = 0
𝑦2′′ − 𝑦2 = 0 𝑦2 (0) = 0; 𝑦2′ (0) = 1
y’’- y = 0 y(0)=0 y’(0)=0
∴ 𝑦0 = 0
2. Find the solution of y’’-2y= 8x(9-x), y(0)=0, y(9)=0
having h=3.
Assume y’(0)=4
y(0)=0
𝑑𝑦
y’’=𝑓(𝑥, 𝑦, )
𝑑𝑥
y’’=2y+8x(9-x), y(0)=0
y’(0)=4
𝑑𝑦
1. = 𝑧 (assume)
𝑑𝑥
𝑓1 (𝑥, 𝑦, 𝑧), 𝑦(0) = 0
𝑑𝑧
2. = 2𝑦 + 8𝑥(9 − 0)
𝑑𝑥
𝑑𝑦
𝑓2 (𝑥, 𝑦, 𝑧), 𝑧(0) = (0) = 4
𝑑𝑥
𝑦1+1 = 𝑦𝑖 + 𝑓1 (𝑥, 𝑦, 𝑧)ℎ
𝑧1+1 = 𝑧𝑖 + 𝑓2 (𝑥, 𝑦, 𝑧)ℎ
X=0, i=0; x=3, i=1;x=6, i=2; x=9, i=3
❖ Finite Difference Method
1. Solve for the first derivative value of 𝑓 (𝑥 ) = 5 cos(3𝑥 ) −
1
𝑥
𝑒 , 𝑓(𝑥0 ) to 𝑓(𝑥0 + 3ℎ) at 𝑥0 = 3 and h=0.2
2
𝑓(𝑥0 ) = 𝑓(3) = −4.778781
𝑓(𝑥0 + ℎ) = 𝑓(3.2) = −5.125336
𝑓(𝑥0 + 2ℎ) = 𝑓(3.4) = −3.754012
𝑓(𝑥0 + 3ℎ) = 𝑓(3.6) = −1.136948
First Derivative:
1 3 1
𝑓 ′ (𝑥0 ) =
[− 𝑓(𝑥0 ) + 2 𝑓(𝑥0 + ℎ) − 𝑓(𝑥0 + 2ℎ)
ℎ 2 2
1 3 1
𝑓 ′ (3) = [− (−4.778781) + 2 (−5.125336) − (−3.754012)
0.2 2 2
= -6.027473
1
nd 𝑥
2. Solve for the 2 derivative of 𝑓 (𝑥 ) = 5 cos(3𝑥 ) − 𝑒 2 ,
𝑓 (𝑥0 ) to 𝑓 (𝑥0 + 3ℎ) at 𝑥0 = 3 and h=0.2
1
𝑓 ′′ (𝑥0 ) = [2𝑓(𝑥0 ) − 5𝑓(𝑥0 + ℎ) + 4 𝑓(𝑥0 + 2ℎ) − 𝑓(𝑥0 + 3ℎ)]
ℎ2
1
𝑓 ′′ (3) = [2(−4.778781)
0.22
−5(−5.125336) + 4 (−3.754012 − (−1.136948)]
𝑓 ′′ (3)= 54.750450