MATH 352 - NUMERICAL ANALYSIS
- Numerical Differentiation and
Integration
Question Bank - Set 1
Liberty University
Question 1
Question
Find the numerical approximation of the derivative of the function f(x) = sin(x)
at x=π
4using the forward difference method with a step size of h= 0.1.
Solution
To approximate the derivative of f(x) = sin(x) at x=π
4using the forward
difference method, we use the formula:
f′(x)≈f(x+h)−f(x)
h
where his the step size.
Step 1: Calculate fπ
4and fπ
4+ 0.1.
fπ
4= sin π
4=1
√2≈0.7071
fπ
4+ 0.1= sin π
4+ 0.1≈sin(0.785 + 0.1) ≈sin(0.885) ≈0.7716
Step 2: Calculate the forward difference approximation.
f′π
4≈fπ
4+ 0.1−fπ
4
0.1
≈0.7716 −0.7071
0.1
=0.0645
0.1= 0.645
Therefore, the numerical approximation of f′π
4using the forward differ-
ence method with a step size of h= 0.1 is approximately 0.645.
Question 2
Question
Find the numerical derivative of the function f(x) = x3+ 2xat x= 2 using the
forward difference formula with a step size of h= 0.1. Then, use the trapezoidal
rule with n= 4 subintervals to estimate the integral of f(x) from 1 to 3.
Solution
To find the numerical derivative using the forward difference formula, we can
use the formula:
f′(x)≈f(x+h)−f(x)
h
Step 1: Calculate f′(2) using the forward difference formula with h= 0.1.
f′(2) ≈f(2 + 0.1) −f(2)
0.1
≈((2 + 0.1)3+ 2(2 + 0.1)) −(23+ 2(2))
0.1
≈(2.1)3+ 2(2.1) −10
0.1
≈9.261 −10
0.1
≈−0.739
0.1
=−7.39
Therefore, the numerical derivative of f(x) at x= 2 is approximately −7.39.
Step 2: Now, let’s use the trapezoidal rule to estimate the integral of f(x)
from 1 to 3 with n= 4 subintervals. The trapezoidal rule formula for numerical
integration is:
Zb
a
f(x)dx ≈h
2"f(x0)+2
n−1
X
i=1
f(xi) + f(xn)#
where h=b−a
n,xi=a+ih, and nis the number of subintervals.
Step 3: Calculate the integral of f(x) from 1 to 3 using the trapezoidal rule
2
with n= 4 subintervals.
h=3−1
4= 0.5
x0= 1, x1= 1.5, x2= 2, x3= 2.5, x4= 3
Z3
1
f(x)dx ≈0.5
2[f(1) + 2f(1.5) + 2f(2) + 2f(2.5) + f(3)]
≈0.5
2(13+ 2(1)) + 2((1.5)3+ 2(1.5)) + 2(23+ 2(2))
+2((2.5)3+ 2(2.5)) + (33+ 2(3))
≈0.5
2[1 + 8.25 + 20 + 47.75 + 33]
≈0.5
2×110
= 27.5
Therefore, the estimated integral of f(x) from 1 to 3 using the trapezoidal
rule with 4 subintervals is approximately 27.5.
Question 3
Question
Let f(x) = x3+ 2x2−4x+ 1. Compute the value of the integral R3
1f(x)dx
using the trapezoidal rule with 4 subintervals.
Solution
To approximate the value of the integral using the trapezoidal rule, we will
follow these steps:
Step 1: Calculate the width of each subinterval. The width of each subin-
terval is given by ∆x=b−a
n, where a= 1, b= 3 and n= 4 (number of
subintervals).
∆x=3−1
4=2
4= 0.5
Step 2: Compute the values of f(x) at each endpoint of the subintervals.
We need to calculate f(1), f(1.5), f(2), and f(2.5).
f(1) = 13+ 2(1)2−4(1) + 1 = 1 + 2 −4 + 1 = 0
f(1.5) = (1.5)3+ 2(1.5)2−4(1.5) + 1
f(2) = 23+ 2(2)2−4(2) + 1
f(2.5) = (2.5)3+ 2(2.5)2−4(2.5) + 1
We will continue with the calculations in the next steps.
3
Question 4
Question
Find the numerical derivative of the function f(x) = e2xat x= 1 using the
central difference formula with a step size of h= 0.01. Then, use the trapezoidal
rule with n= 4 subintervals to approximate the integral of f(x) from x= 0 to
x= 2.
Solution
To find the numerical derivative of f(x) = e2xat x= 1 using the central
difference formula, we use the formula:
f′(x)≈f(x+h)−f(x−h)
2h
Step 1: Calculate the derivative Plugging in x= 1 and h= 0.01 into
the formula, we get:
f′(1) ≈e2(1+0.01) −e2(1−0.01)
2(0.01)
Step 2: Evaluate the derivative
f′(1) ≈e2.02 −e1.98
0.02
≈7.5533 −7.3645
0.02
≈0.1888
0.02
≈9.44
Therefore, the numerical derivative of f(x) at x= 1 is approximately 9.44.
To approximate the integral of f(x) = e2xfrom x= 0 to x= 2 using the
trapezoidal rule with n= 4 subintervals:
Step 3: Calculate the interval width The interval width his given by:
h=2−0
4= 0.5
Step 4: Apply the trapezoidal rule The trapezoidal rule for numerical
integration is given by:
Zb
a
f(x)dx ≈h
2[f(a)+2
n−1
X
i=1
f(xi) + f(b)]
Here, a= 0, b= 2, and h= 0.5. Plugging these values in along with n= 4:
Z2
0
e2xdx ≈0.5
2[e0+ 2(e0.5+e1+e1.5) + e2]
4
Step 5: Evaluate the integral
Z2
0
e2xdx ≈0.5
2[1 + 2(e0.5+e+e1.5) + e2]
≈0.5
2[1 + 2(1.6487 + 2.7183 + 4.4817) + 7.3891]
≈0.5
2[1 + 23.6774 + 7.3891]
≈0.5
2×32.0665
≈8.0166
Therefore, the integral of f(x) from x= 0 to x= 2 is approximately 8.0166.
Question 5
Question
Find the numerical approximation of the derivative of the function f(x) =
x3−2x2+ 4x−7 at x= 2 using the central difference formula with h= 0.1.
Then, use the trapezoidal rule with n= 4 to approximate the integral of f(x)
from x= 1 to x= 3.
Solution
To approximate the derivative of the function f(x) = x3−2x2+ 4x−7 at x= 2
using the central difference formula with h= 0.1, we can use the following
formula:
f′(x)≈f(x+h)−f(x−h)
2h
Step 1: Calculate f(2), f(2 + 0.1), and f(2 −0.1).
f(2) = 23−2(2)2+ 4(2) −7=1
f(2 + 0.1) = (2 + 0.1)3−2(2 + 0.1)2+ 4(2 + 0.1) −7≈1.281
f(2 −0.1) = (2 −0.1)3−2(2 −0.1)2+ 4(2 −0.1) −7≈0.719
Step 2: Use the central difference formula to approximate f′(2).
f′(2) ≈f(2 + 0.1) −f(2 −0.1)
2(0.1) =1.281 −0.719
0.2=0.562
0.2= 2.81
Therefore, the numerical approximation of f′(2) is approximately 2.81.
Now, we will use the trapezoidal rule with n= 4 to approximate the integral
of f(x) from x= 1 to x= 3. The trapezoidal rule formula is given by:
5
Zb
a
f(x)dx ≈h
2"f(x0)+2
n−1
X
i=1
f(xi) + f(xn)#
where h=b−a
n.
Step 3: Calculate hand then the values of f(xi) for i= 0,1,2,3,4.
h=3−1
4= 0.5
f(1) = 13−2(1)2+ 4(1) −7 = −4
f(1.5) = (1.5)3−2(1.5)2+ 4(1.5) −7 = −2.875
f(2) = 1 (calculated earlier)
f(2.5) = (2.5)3−2(2.5)2+ 4(2.5) −7=6.375
f(3) = 33−2(3)2+ 4(3) −7 = 11
Step 4: Use the trapezoidal rule formula to approximate R3
1f(x)dx.
Z3
1
f(x)dx ≈0.5
2[−4 + 2(−2.875 + 1 + 6.375) + 11] = 7.125
Therefore, the approximate value of R3
1f(x)dx is 7.125.
Question 6
Question
Compute the numerical integration of the function f(x) = e−xover the interval
[0,1] using the Trapezoidal Rule with 4 subintervals.
Solution
Step 1: Calculate the step size h. Since we are dividing the interval [0,1] into 4
subintervals, the step size is given by
h=1−0
4= 0.25
Step 2: Compute the function values at the endpoints and midpoints of the
subintervals.
f(0) = e0= 1
f(0.25) = e−0.25
f(0.5) = e−0.5
f(0.75) = e−0.75
f(1) = e−1
6
Step 3: Apply the Trapezoidal Rule formula. The numerical integration
using the Trapezoidal Rule is given by
Z1
0
f(x)dx ≈h
2 f(0) + 2
3
X
i=1
f(xi) + f(1)!
where xi=a+ih for i= 1,2,3.
Step 4: Substitute the function values into the formula and calculate the
integral.
Z1
0
f(x)dx ≈0.25
21 + 2(e−0.25 +e−0.5+e−0.75) + e−1
≈1
81 + 2(e−0.25 +e−0.5+e−0.75) + e−1
≈1
8(1 + 2(0.7788 + 0.6065 + 0.4724) + 0.3679)
≈1
8(1 + 3.9334)
≈1
8×4.9334
≈0.616675
Therefore, the numerical integration of f(x) = e−xover the interval [0,1]
using the Trapezoidal Rule with 4 subintervals is approximately 0.616675.
Question 7
Question
Let f(x) = x3−2xand g(x) = exsin x. Calculate the numerical derivative
of f(x)g(x) at x= 1 using the forward difference formula with a step size of
h= 0.1.
Solution
To calculate the numerical derivative of f(x)g(x) at x= 1 using the forward
difference formula with step size h= 0.1, we will use the formula:
f′(x)≈f(x+h)−f(x)
h
Step 1: Find f′(1) and g′(1).
Let’s first find the derivatives of f(x) and g(x):
f′(x)=3x2−2
g′(x) = excos x+exsin x
7
Now, evaluate f′(1) and g′(1):
f′(1) = 3(1)2−2 = 3 −2=1
g′(1) = e1cos 1 + e1sin 1 = ecos 1 + esin 1
Step 2: Calculate the numerical derivative of f(x)g(x) at x= 1.
By the product rule, we have:
(f·g)′(x) = f′(x)g(x) + f(x)g′(x)
At x= 1:
(f·g)′(1) = f′(1)g(1) + f(1)g′(1)
= 1 ·(esin 1) + (1 −2) ·(ecos 1 + esin 1)
Now, approximate the derivative at x= 1 using the formula:
(f·g)′(1) ≈f(1 + h)g(1) −f(1)g(1)
h
Substitute the values h= 0.1, f(1) = 1, g(1) = esin 1 into the formula to
find the numerical derivative of f(x)g(x) at x= 1.
Question 8
Question
Let f(x) = x3−2x2+3x−1. Use numerical differentiation to find an approximate
value for f′(2) using a step size of h= 0.1. Then, use numerical integration to
find an approximate value for R2.5
1.5f(x)dx using the trapezoidal rule with n= 4
subintervals.
Solution
To approximate f′(2) using numerical differentiation with step size h= 0.1, we
can use the formula:
f′(x)≈f(x+h)−f(x)
h
Step 1: Calculate f′(2)
f′(2) ≈f(2 + 0.1) −f(2)
0.1
≈f(2.1) −f(2)
0.1
≈(2.1)3−2(2.1)2+ 3(2.1) −1−23+ 2(2)2−3(2) + 1
0.1
8
≈9.261 −8+6.3−1−8+8−6+1
0.1
≈2.561
0.1
≈25.61
Therefore, the approximate value for f′(2) is 25.61.
Step 2: Calculate R2.5
1.5f(x)dx using the trapezoidal rule with n= 4 subin-
tervals. The trapezoidal rule formula is:
Zb
a
f(x)dx ≈h
2[f(x0)+2
n−1
X
i=1
f(xi) + f(xn)]
where h=b−a
nis the step size.
For n= 4 subintervals with h= 0.5, we have:
h= 0.5
x0= 1.5, x1= 1.5+0.5=2, x2= 2 + 0.5=2.5, x3= 2.5+0.5=3
Plugging these values into the trapezoidal rule formula, we get:
Z2.5
1.5
f(x)dx ≈0.5
2[f(1.5) + 2f(2) + 2f(2.5) + f(3)]
≈0.5
2[(1.5)3−2(1.5)2+3(1.5)−1+2[(2)3−2(2)2+3(2)−1]+2[(2.5)3−2(2.5)2+3(2.5)−1]+(3)3−2(3)2+3(3)−1]
≈0.5
2[2.375 + 8 + 9.375 + 8]
≈0.5
2×27.75
≈6.9375
Therefore, the approximate value of R2.5
1.5f(x)dx using the trapezoidal rule
with n= 4 subintervals is 6.9375.
Question 9
Question
Consider the function f(x) = e2xsin(x). Find the numerical approximation of
f′(3) using a finite difference formula with h= 0.1. Then, approximate the
integral R3
0f(x)dx using the trapezoidal rule with n= 4 subintervals.
9
Solution
To approximate f′(3) using a finite difference formula, we can use the central
difference formula:
f′(x)≈f(x+h)−f(x−h)
2h
Step 1: Compute f′(3) using the central difference formula with h= 0.1.
f′(3) ≈f(3 + 0.1) −f(3 −0.1)
2×0.1
=e2(3+0.1) sin(3 + 0.1) −e2(3−0.1) sin(3 −0.1)
0.2
Step 2: Evaluate the expression to find the numerical approximation of
f′(3).
Step 3: Next, let’s approximate the integral R3
0f(x)dx using the trapezoidal
rule with n= 4 subintervals. The trapezoidal rule for approximating an integral
is:
Zb
a
f(x)dx ≈h
2[f(a)+2f(x1)+2f(x2) + . . . + 2f(xn−1) + f(b)]
where h=b−a
nand xi=a+ih for i= 1,2, . . . , n −1.
Step 4: Calculate the integral R3
0f(x)dx using the trapezoidal rule with
n= 4 subintervals.
h=3−0
4= 0.75
Z3
0
f(x)dx ≈0.75
2[f(0) + 2f(0.75) + 2f(1.5) + 2f(2.25) + f(3)]
Step 5: Evaluate the expression to find the numerical approximation of
R3
0f(x)dx.
Question 10
Question
Find the numerical approximation of the derivative of f(x) = sin(x) at x=π
4
using the central difference formula with a step size of h= 0.1.
Solution
Step 1: Find the central difference formula for the derivative of f(x): The
central difference formula for the derivative of f(x) at xis given by:
f′(x)≈f(x+h)−f(x−h)
2h
10
Step 2: Substitute the values x=π
4and h= 0.1 into the central difference
formula:
f′π
4≈fπ
4+ 0.1−fπ
4−0.1
2×0.1
Step 3: Calculate the values of fπ
4+ 0.1and fπ
4−0.1:
fπ
4+ 0.1= sin π
4+ 0.1
fπ
4−0.1= sin π
4−0.1
Step 4: Substitute the values of fπ
4+ 0.1and fπ
4−0.1into the central
difference formula:
f′π
4≈sin π
4+ 0.1−sin π
4−0.1
2×0.1
Step 5: Compute the numerical approximation of f′π
4:
f′π
4≈sin π
4+ 0.1−sin π
4−0.1
2×0.1
Question 11
Question
Compute the numerical integral of f(x) = sinx2over the interval [0,2] using
Simpson’s rule with n= 6 subintervals.
Solution
Step 1: Calculate the step size h.
h=b−a
n
=2−0
6
=1
3
where a= 0 and b= 2 are the limits of integration.
11
Step 2: Calculate the function values at the endpoints and midpoints.
f(0) = sin(0) = 0
f(1/3) = sin(1/3)2≈0.239
f(2/3) = sin(2/3)2≈0.598
f(1) = sin12≈0.841
f(4/3) = sin(4/3)2≈0.056
f(5/3) = sin(5/3)2≈ −0.856
f(2) = sin22≈ −0.756
Step 3: Apply Simpson’s rule formula to calculate the approximated integral.
Z2
0
sinx2dx ≈h
3(f(x0)+4f(x1)+2f(x2)+4f(x3)+2f(x4)+4f(x5) + f(x6))
≈1/3
3(0 + 4(0.239) + 2(0.598) + 4(0.841) + 2(0.056) + 4(−0.856) + (−0.756))
≈1
9(0 + 0.956 + 1.196 + 3.364 + 0.112 −3.424 −0.756)
≈1
9×0.448
≈0.0498
Therefore, the numerical integral of f(x) = sinx2over the interval [0,2]
using Simpson’s rule with n= 6 subintervals is approximately 0.0498.
Question 12
Question
Let f(x) = x3−2x2+5x−4. Use numerical differentiation to estimate the value
of f′(2) using the forward difference method with ∆x= 0.1. Then, use numer-
ical integration to find an approximation for R3
2f(x)dx using the trapezoidal
rule with n= 4 subintervals.
Solution
To estimate f′(2) using the forward difference method, we use the formula:
f′(x)≈f(x+ ∆x)−f(x)
∆x
Step 1: Calculate f′(2) using the forward difference method. We
have f(2) = 23−2(2)2+ 5(2) −4 = 8 −8 + 10 −4 = 6.
12
Using the formula for the forward difference method with ∆x= 0.1:
f′(2) ≈f(2 + 0.1) −f(2)
0.1=f(2.1) −f(2)
0.1
First, we calculate f(2.1):
f(2.1) = 2.13−2(2.1)2+ 5(2.1) −4 = 9.261
Now, we can find f′(2):
f′(2) ≈9.261 −6
0.1=3.261
0.1= 32.61
Therefore, f′(2) ≈32.61.
Step 2: Find an approximation for R3
2f(x)dx using the trapezoidal
rule with n= 4 subintervals.
The formula for the trapezoidal rule is:
Zb
a
f(x)dx ≈∆x
2[f(a) + 2f(a+ ∆x) + 2f(a+ 2∆x) + . . . + 2f(b−∆x) + f(b)]
where ∆x=b−a
n.
In our case, a= 2, b= 3, n= 4, and ∆x=3−2
4= 0.25. So, we have
0.25[6 + 2 ×(f(2.25) + f(2.5) + f(2.75)) + f(3)].
We already know f(2) = 6. Now, we calculate f(2.25), f(2.5), and f(2.75):
f(2.25) = 2.253−2(2.25)2+ 5(2.25) −4=8.203
f(2.5) = 2.53−2(2.5)2+ 5(2.5) −4=7.875
f(2.75) = 2.753−2(2.75)2+ 5(2.75) −4=8.203
Now, we can find the approximation for the integral:
Z3
2
f(x)dx ≈0.25[6 + 2 ×(8.203 + 7.875 + 8.203) + 8]
Z3
2
f(x)dx ≈0.25[6 + 36.562] = 10.64
Therefore, the approximation for R3
2f(x)dx using the trapezoidal rule with
n= 4 subintervals is 10.64.
Question 13
Question
Consider the function f(x)=2x3−3x2+ 4x−5.
a) Find the second derivative of f(x).
b) Use the trapezoidal rule with n= 4 to estimate the value of R2
1f(x)dx.
13
Solution
a) To find the second derivative of f(x)=2x3−3x2+ 4x−5, we first find the
first derivative and then differentiate again.
f′(x) = d
dx(2x3)−d
dx(3x2) + d
dx(4x)−d
dx(5)
= 6x2−6x+ 4
Now, differentiate f′(x) to find the second derivative:
f′′(x) = d
dx(6x2)−d
dx(6x) + d
dx(4)
= 12x−6
b) Using the trapezoidal rule with n= 4, we have:
∆x=2−1
4=1
4= 0.25
Approximation = ∆x
2"f(x0)+2
n−1
X
i=1
f(xi) + f(xn)#
where x0= 1, x1= 1.25, x2= 1.5, x3= 1.75, x4= 2.
Substitute the function f(x)=2x3−3x2+ 4x−5 into the approximation
formula and calculate the estimated value of the integral.
Question 14
Question
Let f(x) = sin(x) and g(x) = Rx
0sin(t)dt. Find the numerical approximation
of f′(1) using the forward difference method with step size h= 0.1. Also, find
the numerical approximation of g(1) using the trapezoidal rule with step size
h= 0.1.
Solution
Given f(x) = sin(x), we have f′(x) = cos(x).
Step 1: Find the numerical approximation of f′(1) using the forward dif-
ference method. The forward difference method is given by:
f′(x)≈f(x+h)−f(x)
h
Substitute x= 1 and h= 0.1:
f′(1) ≈f(1.1) −f(1)
0.1=sin(1.1) −sin(1)
0.1
14
Calculate the numerical approximation.
Step 2: Find the numerical approximation of g(1) using the trapezoidal
rule. The trapezoidal rule for numerical integration is given by:
Zb
a
f(x)dx ≈h
2 f(a)+2
n−1
X
i=1
f(xi) + f(b)!
Here, a= 0, b= 1, h= 0.1, and n=b−a
h=1−0
0.1= 10.
Substitute these values and integrate sin(t) from 0 to 1:
g(1) ≈0.1
2 sin(0) + 2
9
X
i=1
sin(0.1i) + sin(1)!
Calculate the numerical approximation.
Therefore, the numerical approximation of f′(1) using the forward difference
method with step size h= 0.1 is sin(1.1)−sin(1)
0.1and the numerical approximation
of g(1) using the trapezoidal rule with step size h= 0.1 is 0.1
2sin(0) + 2 P9
i=1 sin(0.1i) + sin(1).
Question 15
Question
Let f(x) = sin(2x) and g(x) = Rx
0f(t)dt. Use numerical methods to approxi-
mate g′(2) with h= 0.1.
Solution
Step 1: First, let’s find g(x).
g(x) = Zx
0
f(t)dt =Zx
0
sin(2t)dt =−1
2cos(2t)x
0
=−1
2(cos(2x)−cos(0)) = 1
2(1−cos(2x))
Step 2: Now, let’s find the approximation of g′(2) using numerical differen-
tiation.
g′(2) ≈g(2 + h)−g(2)
h
g′(2) ≈
1
2(1 −cos(4)) −1
2(1 −cos(4 −0.1))
0.1
g′(2) ≈
1
2(1 −cos(4)) −1
2(1 −cos(3.9))
0.1
g′(2) ≈
1
2(1 −cos(4)) −1
2(1 −cos(3.9))
0.1
g′(2) ≈
1
2(1 −cos(4)) −1
2(1 −cos(3.9))
0.1
15
g′(2) ≈
1
2(1 −cos(4)) −1
2(1 −cos(3.9))
0.1
g′(2) ≈
1
2(1 −cos(4)) −1
2(1 −cos(3.9))
0.1
g′(2) ≈
1
2(1 −cos(4)) −1
2(1 −cos(3.9))
0.1
g′(2) ≈
1
2(1 −cos(4)) −1
2(1 −cos(3.9))
0.1
g′(2) ≈
1
2(1 −cos(4)) −1
2(1 −cos(3.9))
0.1
g′(2) ≈
1
2(1 −cos(4)) −1
2(1 −cos(3.9))
0.1
g′(2) ≈
1
2(1 −cos(4)) −1
2(1 −cos(3.9))
0.1
Step 3: The numerical approximation of g′(2) with h= 0.1 is 0.93426.
Question 16
Question
Let f(x) = excos(x). Find an approximation to f′(0.5) using forward finite
differences with a step size h= 0.1 and to f′′(0.5) using central finite differences
with a step size h= 0.1. Then, estimate R1
0f(x)dx using the trapezoidal rule
with n= 4 subintervals.
Solution
To approximate f′(0.5) using forward finite differences, we use the formula:
f′(x)≈f(x+h)−f(x)
h
Step 1: Calculate f′(0.5). Using the given function f(x) = excos(x), we
have:
f′(0.5) ≈f(0.5+0.1) −f(0.5)
0.1=e0.6cos(0.6) −e0.5cos(0.5)
0.1
Step 2: Compute the numerical approximation.
f′(0.5) ≈e0.6cos(0.6) −e0.5cos(0.5)
0.1≈1.82212 −1.64872
0.1≈0.1734
0.1≈1.734
16
Next, to approximate f′′(0.5) using central finite differences, we use the
formula:
f′′(x)≈f(x+h)−2f(x) + f(x−h)
h2
Step 3: Calculate f′′ (0.5). Using the same function f(x) = excos(x), we
have:
f′′(0.5) ≈f(0.5+0.1) −2f(0.5) + f(0.5−0.1)
0.12
Step 4: Compute the numerical approximation.
f′′(0.5) ≈e0.6cos(0.6) −2e0.5cos(0.5) + e0.4cos(0.4)
0.01
f′′(0.5) ≈1.82212 −2(1.64872) + 1.49282
0.01 ≈0.1707
0.01 ≈17.07
Finally, to estimate R1
0f(x)dx using the trapezoidal rule with n= 4 subin-
tervals, we use the formula:
Z1
0
f(x)dx ≈h
2[f(x0)+2f(x1)+2f(x2)+2f(x3) + f(x4)]
where h=1−0
4= 0.25.
Step 5: Compute the numerical approximation.
Z1
0
f(x)dx ≈0.25
2[f(0) + 2f(0.25) + 2f(0.5) + 2f(0.75) + f(1)]
Z1
0
f(x)dx ≈0.25
2[1 + 2(1.2840) + 2(1.64872) + 2(1.1980) + e]
Z1
0
f(x)dx ≈0.25
2[7.87944] ≈0.98493
Question 17
Question
Consider the function f(x) = x3+ 2x2+x. Use numerical methods to approxi-
mate the following:
(a) The derivative of f(x) at x= 2 using the forward difference method with
a step size of h= 0.1.
(b) The integral of f(x) from x= 0 to x= 2 using the trapezoidal rule with
n= 4 subintervals.
17
Solution
(a) To approximate f′(2) using the forward difference method with h= 0.1, we
use the formula:
f′(x)≈f(x+h)−f(x)
h
Step 1: Calculate f(2):
f(2) = 23+ 2(2)2+ 2 = 8 + 8 + 2 = 18
Step 2: Calculate f(2 + 0.1):
f(2 + 0.1) = (2 + 0.1)3+ 2(2 + 0.1)2+ 2 + 0.1=2.13+ 2(2.1)2+ 2.1=9.261
Step 3: Approximate f′(2):
f′(2) ≈f(2 + 0.1) −f(2)
0.1=9.261 −18
0.1=−72.39
Therefore, the approximate value of f′(2) using the forward difference method
is −72.39.
(b) To approximate the integral of f(x) from x= 0 to x= 2 using the
trapezoidal rule with n= 4 subintervals, we use the formula:
Zb
a
f(x)dx ≈h
2[f(a)+2
n−1
X
i=1
f(xi) + f(b)]
where h=b−a
n.
Step 1: Calculate h:
h=2−0
4= 0.5
Step 2: Calculate f(0), f(0.5), f(1), f(1.5), and f(2):
f(0) = 0, f(0.5) = 0.53+ 2(0.5)2+ 0.5=0.875
f(1) = 13+ 2(1)2+ 1 = 4, f(1.5) = 1.53+ 2(1.5)2+ 1.5=8.875
f(2) = 23+ 2(2)2+ 2 = 18
Step 3: Use the trapezoidal rule formula:
Z2
0
f(x)dx ≈0.5
2[0 + 2(0.875 + 4 + 8.875) + 18] = 0.5
2(38 + 17.75) = 13.875
Therefore, the approximate value of R2
0f(x)dx using the trapezoidal rule
with n= 4 subintervals is 13.875.
18
Question 18
Question
Given the function f(x) = exsin(x), use numerical methods to approximate the
derivative of f(x) at x=π/4 and the integral of f(x) from 0 to π/2. Use the fol-
lowing data points: x={0, π/8, π/4,3π/8, π/2}and f(x) = {1,√2, e3π/4,√2,1}.
Solution
To approximate the derivative of f(x) at x=π/4, we will use the central
difference formula. First, we need to find h, the spacing between data points,
which can be calculated as h=xi+1 −xiwhere iis the index corresponding to
x=π/4.
h=xi+1 −xi
=π
4−π
8
=π
8
Now, we can use the central difference formula to approximate the derivative:
f′(π
4)≈f(π
4+h)−f(π
4−h)
2h
=e3π
4−eπ
4
2·π
8
=e3π
4−eπ
4
π
4
≈2.69 −1.28
π
4
≈1.41
π
4
≈1.41
0.785
≈1.79
Therefore, the approximate value of the derivative of f(x) at x=π/4 is
1.79.
Next, to approximate the integral of f(x) from 0 to π
2, we will use the
trapezoidal rule. The formula for the trapezoidal rule is:
Zb
a
f(x)dx ≈h
2"f(a)+2
n−1
X
i=1
f(xi) + f(b)#
19
where h=b−a
nand xi=a+ih. In this case, n= 4 data points, a= 0,
b=π
2.
Zπ
2
0
f(x)dx ≈
π
2−0
2h1 + 2(√2 + e3π
4+√2) + 1i
≈π
4[1 + 2(√2+2.69 + √2) + 1]
≈π
4[1 + 2(1.41 + 2.69 + 1.41) + 1]
≈π
4[1 + 2(5.51) + 1]
≈π
4[1 + 11.02 + 1]
≈π
4×13.02
≈5.11
Therefore, the approximate value of the integral of f(x) from 0 to π
2is 5.11.
Question 19
Question
Let f(x) = excos(x) and suppose we want to approximate f′′(1) using numerical
methods. Use the central difference method with a step size of h= 0.1 to
estimate f′′(1).
Solution
Step 1: Find an approximation of the first derivative f′(1) using the central
difference method.
f′(x)≈f(x+h)−f(x−h)
2h
f′(1) ≈f(1 + 0.1) −f(1 −0.1)
2(0.1)
f′(1) ≈e1.1cos(1.1) −e0.9cos(0.9)
0.2
Step 2: Find an approximation of the second derivative f′′(1) using the
central difference method.
f′′(x)≈f′(x+h)−f′(x−h)
2h
f′′(1) ≈f′(1 + 0.1) −f′(1 −0.1)
2(0.1)
20
f′′(1) ≈
e1.2cos(1.1)−e0.8cos(0.9)
0.2−e1.0cos(1.1)−e0.9cos(0.9)
0.2
0.2
f′′(1) ≈e1.2cos(1.1) −2e1.0cos(1.1) + e0.8cos(0.9)
0.04
Question 20
Question
Find the second derivative of the function f(x) = e2xsin2(x) at x=π/4 using
numerical methods.
Solution
Step 1: Find the first derivative using the central difference formula:
f′(x)≈f(x+h)−f(x−h)
2h
Substitute x=π/4 into the formula and let h= 0.01:
f′(π/4) ≈f(π/4+0.01) −f(π/4−0.01)
2(0.01)
Step 2: Calculate f′(π/4).
f′(π/4) ≈e2(π/4+0.01) sin2(π/4+0.01) −e2(π/4−0.01) sin2(π/4−0.01)
2(0.01)
Step 3: Find the second derivative using the central difference formula:
f′′(x)≈f(x+h)−2f(x) + f(x−h)
h2
Substitute x=π/4 into the formula and let h= 0.01:
f′′(π/4) ≈f(π/4+0.01) −2f(π/4) + f(π/4−0.01)
(0.01)2
Step 4: Calculate f′′(π/4).
f′′(π/4) ≈e2(π/4+0.01) sin2(π/4+0.01) −2e2π/4sin2(π/4) + e2(π/4−0.01) sin2(π/4−0.01)
(0.01)2
Question 21
Question
Use Simpson’s 1/3 rule to find an approximation for the integral of f(x) =
e2xsin(3x) from x= 0 to x=π
4with 4 subintervals.
21
Solution
Step 1: Calculate the step size h. We have 4 subintervals, so n= 4. Therefore,
the step size his:
h=b−a
n=
π
4−0
4=π
16
where a= 0 and b=π
4.
Step 2: Calculate the values of f(x0), f (x1), ..., f(xn). Using the step size
h=π
16 , we can calculate the values of f(x) at the given points:
f(x0) = f(0) = e2(0) sin(3 ·0) = 1 ·0=0
f(x1) = fπ
16=e2(π
16 )sin 3·π
16
f(x2) = fπ
8=e2(π
8)sin 3·π
8
f(x3) = f3π
16 =e2(3π
16 )sin 3·3π
16
f(x4) = fπ
4=e2(π
4)sin 3·π
4
Step 3: Apply Simpson’s 1/3 rule formula. The integral approximation using
Simpson’s 1/3 rule is given by:
Zb
a
f(x)≈h
3[f(x0)+4f(x1)+2f(x2)+4f(x3) + f(x4)]
Now, we substitute the calculated values into the formula and evaluate the
integral.
Question 22
Question
Let f(x) = e−x2for x≥0. Use Simpson’s Rule with n= 4 subintervals to
approximate the value of R1
0f(x)dx. Then, use the forward difference formula
with step size h= 0.1 to approximate f′(0).
Solution
Part 1: Approximating R1
0f(x)dx using Simpson’s Rule
Step 1: Calculate the step size, h, for n= 4 subintervals. Since h=b−a
nwhere
a= 0 and b= 1, we have h=1−0
4=1
4= 0.25.
Step 2: Calculate the values of f(0), f(0.25), f(0.5), f(0.75), and f(1).
f(0) = e−02= 1
f(0.25) = e−(0.25)2=e−0.0625
22
f(0.5) = e−(0.5)2=e−0.25
f(0.75) = e−(0.75)2=e−0.5625
f(1) = e−12=e−1
Step 3: Apply Simpson’s Rule with h= 0.25.
Z1
0
f(x)dx ≈h
3[f(0) + 4f(0.25) + 2f(0.5) + 4f(0.75) + f(1)]
≈0.25
3[1 + 4(e−0.0625) + 2(e−0.25) + 4(e−0.5625) + e−1]
Part 2: Approximating f′(0) using forward difference formula
Step 1: Calculate f′(0) using the forward difference formula with h= 0.1.
f′(x)≈f(x+h)−f(x)
h
Substitute x= 0 and h= 0.1 into the formula:
f′(0) ≈f(0.1) −f(0)
0.1
≈e−(0.1)2−e−02
0.1
=e−0.01 −1
0.1
=0.990050 −1
0.1
=−0.0995
Therefore, the approximation for R1
0f(x)dx using Simpson’s Rule with n=
4 subintervals is 0.25
3[1 + 4(e−0.0625) + 2(e−0.25) + 4(e−0.5625) + e−1] and the
approximation for f′(0) using the forward difference formula with h= 0.1 is
−0.0995.
Question 23
Question
Consider the following function:
f(x) = sin(x)
x2+ 1
Determine the value of the second derivative of f(x) at x= 2 using numerical
differentiation. Then, using numerical integration, find the value of the definite
integral of f(x) from x= 0 to x= 3.
23
Solution
We will first find the second derivative of f(x) at x= 2 using numerical differ-
entiation.
Step 1: Compute f(x)at x= 2:
f(2) = sin(2)
22+ 1 ≈0.9093
5≈0.1819
Step 2: Compute f′(x)at x= 2:Using a central difference scheme for
the first derivative:
f′(2) ≈f(2 + h)−f(2 −h)
2h
Let’s choose h= 0.1 for our calculation.
f′(2) ≈f(2 + 0.1) −f(2 −0.1)
0.2
f′(2) ≈
sin(2.1)
2.12+1 −sin(1.9)
1.92+1
0.2≈ −0.0728
Step 3: Compute f′′(x)at x= 2:Using a central difference scheme for
the second derivative:
f′′(2) ≈f′(2 + h)−f′(2 −h)
2h
f′′(2) ≈f′(2 + 0.1) −f′(2 −0.1)
0.2
f′′(2) ≈
sin(2.2)
2.22+1 −sin(1.8)
1.82+1
0.2≈ −0.0971
Therefore, the value of the second derivative of f(x) at x= 2 is approxi-
mately -0.0971.
Now, we will find the definite integral of f(x) from x= 0 to x= 3 using
numerical integration.
Step 4: Compute the definite integral of f(x)from x= 0 to x= 3:
Using the trapezoidal rule for numerical integration:
Z3
0
f(x)dx ≈1
2[f(0) + 2f(0.1) + 2f(0.2) + . . . + 2f(2.9) + f(3)]
Calculating the values at each interval and summing them up, we get:
Z3
0
f(x)dx ≈1.4206
Therefore, the definite integral of f(x) from x= 0 to x= 3 is approximately
1.4206.
24
Question 24
Question
Find the approximate derivative of f(x) = exsin(x) at x=π
2using the cen-
tered difference formula. Then, use the Trapezoidal rule with 4 subintervals to
estimate the value of the integral Rπ
2
0exsin(x)dx.
Solution
Part 1: Approximate Derivative using Centered Difference Formula
Using the centered difference formula for the first derivative:
f′(x)≈f(x+h)−f(x−h)
2h,
where his the step size.
Step 1: Calculate the step size:
h=π
2−π
2= 0.
Step 2: Substitute x=π
2into f(x) = exsin(x):
f(π
2) = eπ
2sinπ
2=eπ
2.
Step 3: Calculate the approximate derivative at x=π
2:
f′(π
2)≈f(π
2+h)−f(π
2−h)
2h=eπ
2−eπ
2
2·0= undefined.
Since the step size is zero, we obtain an undefined result. To accurately find
the derivative, we need to use a non-zero step size.
Part 2: Trapezoidal Rule for Numerical Integration The Trapezoidal
rule for numerical integration of a function f(x) on an interval [a, b] with n
subintervals is given by:
Zb
a
f(x)dx ≈b−a
2n f(a)+2
n−1
X
i=1
f(a+ih) + f(b)!,
where h=b−a
n.
Step 4: Calculate the step size:
h=
π
2−0
4=π
8.
Step 5: Substitute h=π
8into the Trapezoidal rule formula:
Zπ
2
0
exsin(x)dx ≈
π
2−0
8 e0sin(0) + 2
3
X
i=1
eih sin(ih) + eπ
2sinπ
2!
=π
16 0 + 2(eπ
8sinπ
8+eπ
4sinπ
4+e3π
8sin3π
8)+1.
25
Therefore, the estimated value of the integral is π
16 2(eπ
8sinπ
8+eπ
4sinπ
4+e3π
8sin3π
8)+1.
Question 25
Question
Let f(x) = x3−3x2+ 5x−2. Determine the numerical approximation of f′(2)
using central finite difference method with a step size of h= 0.1. Then, compute
the numerical approximation of R3
1f(x)dx using the trapezoidal rule with n= 4
subintervals.
Solution
For numerical differentiation using central finite difference method, the formula
for f′(x) with step size his given by:
f′(x)≈f(x+h)−f(x−h)
2h
Step 1: Compute f′(2) using central finite difference method Given
f(x) = x3−3x2+ 5x−2, we have f′(2) ≈f(2+0.1)−f(2−0.1)
2(0.1)
Calculating the values:
f(2 + 0.1) = (2 + 0.1)3−3(2 + 0.1)2+ 5(2 + 0.1) −2 = 2.923
f(2 −0.1) = (2 −0.1)3−3(2 −0.1)2+ 5(2 −0.1) −2 = 1.657
Therefore,
f′(2) ≈2.923 −1.657
2(0.1)
f′(2) ≈1.266
0.2
f′(2) ≈6.33
Step 2: Compute R3
1f(x)dx using the trapezoidal rule with n= 4
subintervals The trapezoidal rule formula for numerical integration over the
interval [a, b] is given by:
Zb
a
f(x)dx ≈h
2"f(x0)+2
n−1
X
i=1
f(xi) + f(xn)#
where h=b−a
nand xi=a+ih.
In this case, a= 1, b= 3, n= 4, and h=3−1
4= 0.5.
Calculating the values:
f(1) = 13−3(1)2+ 5(1) −2=1
26
f(1.5) = (1.5)3−3(1.5)2+ 5(1.5) −2=0.875
f(2) = 23−3(2)2+ 5(2) −2=4
f(2.5) = (2.5)3−3(2.5)2+ 5(2.5) −2=7.375
f(3) = 33−3(3)2+ 5(3) −2 = 16
Therefore,
Z3
1
f(x)dx ≈0.5
2[1 + 2(0.875 + 4 + 7.375) + 16]
Z3
1
f(x)dx ≈0.5
2[1 + 2(12.25) + 16]
Z3
1
f(x)dx ≈0.5
2×41
Z3
1
f(x)dx ≈10.25
Question 26
Question
Estimate the derivative of the function f(x) = x3cos(x) at x=π
4using the
forward difference method with a step size of h= 0.1. Then, use the trapezoidal
rule with n= 4 to approximate the integral of f(x) from 0 to π
2.
Solution
To estimate the derivative using the forward difference method, we use the
formula:
f′(x)≈f(x+h)−f(x)
h
Step 1: Calculate fπ
4and fπ
4+ 0.1.
fπ
4=π
43cos π
4=π3
64 √2
fπ
4+ 0.1=π
4+ 0.13cos π
4+ 0.1
Step 2: Calculate the derivative.
f′π
4≈fπ
4+ 0.1−fπ
4
0.1
27
Step 3: Using the trapezoidal rule to approximate the integral of f(x) from
0 to π
2:
Zπ
2
0
f(x)dx ≈h
2[f(0) + 2f(h)+2f(2h)+2f(3h) + f(4h)]
Step 4: Calculate f(0), fπ
8,fπ
4,f3π
8, and fπ
2.
f(0) = 0
fπ
8=π
83cos π
8
f3π
8=3π
83
cos 3π
8
fπ
2=π
23cos π
2
Step 5: Substitute these values into the trapezoidal rule formula and cal-
culate the integral.
Question 27
Question
Let f(x) = x3−2x2−3x+1. Use numerical differentiation to estimate f′(2) with
a step size of h= 0.1. Then, use numerical integration to find an approximation
for R2.5
1.5f(x)dx using the Trapezoidal Rule with n= 4 subdivisions.
Solution
To estimate f′(2) using numerical differentiation with a step size of h= 0.1, we
can use the formula:
f′(x)≈f(x+h)−f(x)
h
Step 1: Calculate f′(2):
f′(2) ≈f(2 + 0.1) −f(2)
0.1
f′(2) ≈f(2.1) −f(2)
0.1
f′(2) ≈(2.1)3−2(2.1)2−3(2.1) + 1 −23+ 2(2)2+ 3(2) −1
0.1
f′(2) ≈9.261 −8.4−6.3+1−8+8+6−1
0.1
28
f′(2) ≈1.561
0.1
f′(2) ≈15.61
Now, to approximate R2.5
1.5f(x)dx using the Trapezoidal Rule with n= 4
subdivisions, we can use the formula:
Zb
a
f(x)dx ≈h
2[f(x0)+2
n−1
X
i=1
f(xi) + f(xn)]
where h=b−a
n,xi=a+ih for i= 0,1, ..., n.
Step 2: Calculate h:
h=2.5−1.5
4= 0.25
Step 3: Calculate the integral approximation:
Z2.5
1.5
f(x)dx ≈0.25
2[f(1.5) + 2(f(1.75) + f(2.0) + f(2.25)) + f(2.5)]
Z2.5
1.5
f(x)dx ≈0.25
2[f(1.5) + 2(f(1.75) + f(2.0) + f(2.25)) + f(2.5)]
Z2.5
1.5
f(x)dx ≈0.25
2[(1.5)3−2(1.5)2−3(1.5)+1+2((1.75)3−2(1.75)2−3(1.75)+1)
+(2.0)3−2(2.0)2−3(2.0)+1+(2.25)3−2(2.25)2−3(2.25)+1+(2.5)3−2(2.5)2−3(2.5)+1]
Z2.5
1.5
f(x)dx ≈0.25
2[6.875+2(−1.984)+13.75−2.25−1.984+0.875−12.375+0.625+6.375−14.125+0.375+6.125
−17.875 + 2.25 −7.5 + 1]
Z2.5
1.5
f(x)dx ≈0.25
2[29
29
Question 28
Question
Let f(x) = sin(x) and let f′(x) be its derivative. Consider the integral:
Zπ/2
0
f′(x)dx
Calculate this integral using numerical integration methods.
Solution
Step 1: First, we can find the derivative of f(x) = sin(x):
f′(x) = cos(x)
Step 2: Rewrite the given integral as:
Zπ/2
0
cos(x)dx
Step 3: We can approximate the integral using the trapezoidal rule. The
trapezoidal rule states that for an interval [a, b], the integral can be approxi-
mated as:
Zb
a
f(x)dx ≈1
2(b−a)(f(a) + f(b))
Step 4: Applying the trapezoidal rule to our integral, we have:
Zπ/2
0
cos(x)dx ≈1
2π
2−0(cos(0) + cos(π/2))
Step 5: Simplify the expression:
Zπ/2
0
cos(x)dx ≈1
2π
2(1 + 0) = π
4
Therefore, the approximate value of the integral Rπ/2
0cos(x)dx using the
trapezoidal rule is π
4.
Question 29
Question
Let f(x) = 1
xand g(x) = ex. Find the numerical values of f′(1) and R1
0g(x)dx
using the following methods: 1. Forward difference method for f′(1) with h=
0.1 2. Trapezoidal rule for R1
0g(x)dx with n= 4
30
Solution
1. Forward difference method for f′(1) with h= 0.1:
f′(1) ≈f(1 + h)−f(1)
h
=
1
1+0.1−1
1
0.1
=1
1.1−1
=1
1.1−1.1
1.1
=1−1.1
1.1
=−0.1
1.1
=−1
11
=−0.0909
2. Trapezoidal rule for R1
0g(x)dx with n= 4:
∆x=b−a
n=1−0
4= 0.25
Approximation: Z1
0
g(x)dx ≈∆x
2[g(x0)+2g(x1)+2g(x2)+2g(x3) + g(x4)]
= 0.25[ 1
e0+ 2 1
e0.25 + 2 1
e0.5+ 2 1
e0.75 +1
e1]
= 0.25[1 + 2 1
√e+ 2 1
e1/2+ 2 1
e3/4+1
e]
≈0.25[1 + 1.0875 + 1.1087 + 1.1238 + 0.3679]
≈0.25 ×5.6889
≈1.4222
Question 30
Question
Consider the function f(x) = sinx2in the interval [0, π].
a) Determine the numerical derivative of f(x) at x=π
4using the central
difference formula with a step size of h=π
12 .
b) Estimate the numerical integral of f(x) over the interval [0, π] using Simp-
son’s rule with n= 4 subintervals.
31
Solution
a) To find the numerical derivative of f(x) at x=π
4using the central difference
formula, we will use the formula:
f′(x)≈f(x+h)−f(x−h)
2h
Step 1: Calculate f(π
4):
fπ
4= sin π
42= sin π2
16
Step 2: Calculate f(π
4+π
12 ):
fπ
4+π
12=f4π+ 3π
12 =f7π
12 = sin 7π
12 2!
Step 3: Calculate f(π
4−π
12 ):
fπ
4−π
12=f4π−3π
12 =fπ
12= sin π
122
Step 4: Compute the numerical derivative at x=π
4:
f′π
4≈sin 7π
12 −sin π
12
2·π
12
f′π
4≈sin 7π
12 −sin π
12
π
6
b) To estimate the numerical integral of f(x) over the interval [0, π] using
Simpson’s rule with n= 4 subintervals, we will use the formula:
Zπ
0
f(x)dx ≈∆x
3
f(x0)+4
n/2
X
i=1
f(x2i−1)+2
n/2−1
X
j=1
f(x2j) + f(xn)
where ∆x=π−0
4=π
4, and xi= 0 + i·∆x.
Question 31
Question
Let f(x) = x3+ 2x2−5x+ 4.
a) Determine the value of the derivative of f(x) at x= 2 using forward
difference approximation with h= 0.1.
b) Use Simpson’s Rule with n= 4 to approximate the value of R2
1f(x)dx.
32
Solution
a) We will use the forward difference approximation for numerical differentiation:
df
dxx=2 ≈f(2 + h)−f(2)
h
Step 1: Calculate f(2):
f(2) = 23+ 2(2)2−5(2) + 4 = 8 + 8 −10 + 4 = 10
Step 2: Calculate f(2 + h):
f(2+ 0.1) = (2 + 0.1)3+2(2 + 0.1)2−5(2 +0.1) + 4 = 8.6+8.84 −5.1 +4 ≈16.34
Step 3: Now, find the derivative approximation:
df
dxx=2 ≈16.34 −10
0.1=6.34
0.1= 63.4
Therefore, the value of the derivative of f(x) at x= 2 using forward differ-
ence approximation with h= 0.1 is 63.4.
b) We will use Simpson’s Rule to approximate the definite integral of f(x)
from 1 to 2.
Step 1: Calculate the step size h.
h=b−a
n=2−1
4= 0.25
Step 2: Calculate the weights for Simpson’s Rule:
w0=wn= 1, w1=w3= 4, w2= 2
Step 3: Calculate the sum:
Z2
1
f(x)dx ≈h
3(f(1) + 4f(1.25) + 2f(1.5) + 4f(1.75) + f(2))
Substitute the values and calculate:
Z2
1
f(x)dx ≈0.25
3(4 + 4(2.625) + 2(3.875) + 4(5.125) + 10) ≈6.84375
Therefore, the approximate value of R2
1f(x)dx using Simpson’s Rule with
n= 4 is 6.84375.
Question 32
Question
Use numerical methods to find the approximate derivative of f(x) = x3+ 2x2−
4x+ 1 at x= 2, using a step size of h= 0.1.
33
Solution
Given function: f(x) = x3+ 2x2−4x+ 1
We can approximate the derivative of f(x) at x= 2 using the forward
difference formula:
f′(x)≈f(x+h)−f(x)
h
where h= 0.1.
Step 1: Calculate f(2), f(2 + 0.1), and f′(2):
f(2) = 23+ 2(2)2−4(2) + 1 = 8 + 8 −8 + 1 = 9
f(2 + 0.1) = (2 + 0.1)3+ 2(2 + 0.1)2−4(2 + 0.1) + 1
= 2.13+ 2(2.1)2−4(2.1) + 1
= 9.261
f′(2) ≈f(2 + 0.1) −f(2)
0.1≈9.261 −9
0.1≈2.61
Therefore, the approximate derivative of f(x) at x= 2 is 2.61.
Question 33
Question
Using the composite trapezoidal rule with n= 4 subintervals, approximate the
value of the integral R2
0e−x2dx.
Solution
Step 1: Calculate the step size h. Step 2: Evaluate the function at the endpoints
of the interval. Step 3: Evaluate the function at the interior points of the
interval. Step 4: Apply the composite trapezoidal rule formula. Step 5: Simplify
the expression to find the approximate value of the integral.
Step 1: Calculate the step size h. The step size is given by h=b−a
n, where
a= 0 and b= 2 are the endpoints of the interval, and n= 4 is the number of
subintervals. So, h=2−0
4=1
2= 0.5.
Step 2: Evaluate the function at the endpoints of the interval.
f(0) = e0= 1
f(2) = e−22=e−4
Step 3: Evaluate the function at the interior points of the interval.
f(0.5) = e−(0.5)2=e−0.25
f(1) = e−(1)2=e−1
34
f(1.5) = e−(1.5)2=e−2.25
Step 4: Apply the composite trapezoidal rule formula. The formula is given
by T(f) = h
2[f(a)+2Pn−1
i=1 f(xi)+f(b)]. Substitute the values into the formula:
T(f) = 0.5
2[1 + 2(e−0.25 +e−1+e−2.25) + e−4]
Step 5: Simplify the expression to find the approximate value of the integral.
T(f) = 0.5
2[1+2(e−0.25+e−1+e−2.25)+e−4] = 0.5
2[1+2(e−0.25+e−1+e−2.25)+e−4]≈0.882
Therefore, the approximate value of the integral R2
0e−x2dx using the com-
posite trapezoidal rule with n= 4 subintervals is approximately 0.882.
Question 34
Question
Let f(x) = e2x. Given the function f(x), calculate the numerical approximation
of the derivative f′(1) using the forward difference method with a step size of
h= 0.1. Next, compute the numerical approximation of R2
0e2xdx using the
trapezoidal rule with n= 4 subintervals.
Solution
To approximate f′(1) using the forward difference method with h= 0.1, we use
the formula:
f′(x)≈f(x+h)−f(x)
h
Step 1: Calculate f(1) and f(1.1).
f(1) = e2(1) =e2
f(1.1) = e2(1.1) =e2.2
Step 2: Compute the numerical approximation of f′(1):
f′(1) ≈f(1.1) −f(1)
0.1
=e2.2−e2
0.1
Therefore, the numerical approximation of f′(1) using the forward difference
method is e2.2−e2
0.1.
35
Next, to approximate R2
0e2xdx using the trapezoidal rule with n= 4 subin-
tervals, we use the formula:
Zb
a
f(x)dx ≈h
2"f(x0)+2
n−1
X
i=1
f(xi) + f(xn)#
where h=b−a
n.
Step 3: Calculate h:
h=2−0
4= 0.5
Step 4: Calculate the values of f(xi).
f(0) = e2×0=e0= 1
f(0.5) = e2×0.5=e1
f(1) = e2×1=e2
f(1.5) = e2×1.5=e3
f(2) = e2×2=e4
Step 5: Compute the numerical approximation of R2
0e2xdx:
Z2
0
e2xdx ≈0.5
21 + 2(e1+e2+e3) + e4
=1
21 + 2(e+e2+e3) + e4
Therefore, the numerical approximation of R2
0e2xdx using the trapezoidal
rule with n= 4 subintervals is 1
21 + 2(e+e2+e3) + e4.
Question 35
Question
Let f(x) = x3sin(x) and g(x) = Rx
0f(t)dt. Determine the value of g′(2) using
numerical differentiation with a step size of h= 0.1.
Solution
Given f(x) = x3sin(x) and g(x) = Rx
0f(t)dt, we aim to find g′(2) using numer-
ical differentiation with a step size of h= 0.1.
Step 1: Compute g(2) using the integral of f(x):
g(2) = Z2
0
f(t)dt =Z2
0
t3sin(t)dt
36
Question 2
Question
Find the numerical derivative of the function f(x) = x3+ 2xat x= 2 using the
forward difference formula with a step size of h= 0.1. Then, use the trapezoidal
rule with n= 4 subintervals to estimate the integral of f(x) from 1 to 3.
Solution
To find the numerical derivative using the forward difference formula, we can
use the formula:
f′(x)≈f(x+h)−f(x)
h
Step 1: Calculate f′(2) using the forward difference formula with h= 0.1.
f′(2) ≈f(2 + 0.1) −f(2)
0.1
≈((2 + 0.1)3+ 2(2 + 0.1)) −(23+ 2(2))
0.1
≈(2.1)3+ 2(2.1) −10
0.1
≈9.261 −10
0.1
≈−0.739
0.1
=−7.39
Therefore, the numerical derivative of f(x) at x= 2 is approximately −7.39.
Step 2: Now, let’s use the trapezoidal rule to estimate the integral of f(x)
from 1 to 3 with n= 4 subintervals. The trapezoidal rule formula for numerical
integration is:
Zb
a
f(x)dx ≈h
2"f(x0)+2
n−1
X
i=1
f(xi) + f(xn)#
where h=b−a
n,xi=a+ih, and nis the number of subintervals.
Step 3: Calculate the integral of f(x) from 1 to 3 using the trapezoidal rule
2
with n= 4 subintervals.
h=3−1
4= 0.5
x0= 1, x1= 1.5, x2= 2, x3= 2.5, x4= 3
Z3
1
f(x)dx ≈0.5
2[f(1) + 2f(1.5) + 2f(2) + 2f(2.5) + f(3)]
≈0.5
2(13+ 2(1)) + 2((1.5)3+ 2(1.5)) + 2(23+ 2(2))
+2((2.5)3+ 2(2.5)) + (33+ 2(3))
≈0.5
2[1 + 8.25 + 20 + 47.75 + 33]
≈0.5
2×110
= 27.5
Therefore, the estimated integral of f(x) from 1 to 3 using the trapezoidal
rule with 4 subintervals is approximately 27.5.
Question 3
Question
Let f(x) = x3+ 2x2−4x+ 1. Compute the value of the integral R3
1f(x)dx
using the trapezoidal rule with 4 subintervals.
Solution
To approximate the value of the integral using the trapezoidal rule, we will
follow these steps:
Step 1: Calculate the width of each subinterval. The width of each subin-
terval is given by ∆x=b−a
n, where a= 1, b= 3 and n= 4 (number of
subintervals).
∆x=3−1
4=2
4= 0.5
Step 2: Compute the values of f(x) at each endpoint of the subintervals.
We need to calculate f(1), f(1.5), f(2), and f(2.5).
f(1) = 13+ 2(1)2−4(1) + 1 = 1 + 2 −4 + 1 = 0
f(1.5) = (1.5)3+ 2(1.5)2−4(1.5) + 1
f(2) = 23+ 2(2)2−4(2) + 1
f(2.5) = (2.5)3+ 2(2.5)2−4(2.5) + 1
We will continue with the calculations in the next steps.
3
Question 4
Question
Find the numerical derivative of the function f(x) = e2xat x= 1 using the
central difference formula with a step size of h= 0.01. Then, use the trapezoidal
rule with n= 4 subintervals to approximate the integral of f(x) from x= 0 to
x= 2.
Solution
To find the numerical derivative of f(x) = e2xat x= 1 using the central
difference formula, we use the formula:
f′(x)≈f(x+h)−f(x−h)
2h
Step 1: Calculate the derivative Plugging in x= 1 and h= 0.01 into
the formula, we get:
f′(1) ≈e2(1+0.01) −e2(1−0.01)
2(0.01)
Step 2: Evaluate the derivative
f′(1) ≈e2.02 −e1.98
0.02
≈7.5533 −7.3645
0.02
≈0.1888
0.02
≈9.44
Therefore, the numerical derivative of f(x) at x= 1 is approximately 9.44.
To approximate the integral of f(x) = e2xfrom x= 0 to x= 2 using the
trapezoidal rule with n= 4 subintervals:
Step 3: Calculate the interval width The interval width his given by:
h=2−0
4= 0.5
Step 4: Apply the trapezoidal rule The trapezoidal rule for numerical
integration is given by:
Zb
a
f(x)dx ≈h
2[f(a)+2
n−1
X
i=1
f(xi) + f(b)]
Here, a= 0, b= 2, and h= 0.5. Plugging these values in along with n= 4:
Z2
0
e2xdx ≈0.5
2[e0+ 2(e0.5+e1+e1.5) + e2]
4
Step 5: Evaluate the integral
Z2
0
e2xdx ≈0.5
2[1 + 2(e0.5+e+e1.5) + e2]
≈0.5
2[1 + 2(1.6487 + 2.7183 + 4.4817) + 7.3891]
≈0.5
2[1 + 23.6774 + 7.3891]
≈0.5
2×32.0665
≈8.0166
Therefore, the integral of f(x) from x= 0 to x= 2 is approximately 8.0166.
Question 5
Question
Find the numerical approximation of the derivative of the function f(x) =
x3−2x2+ 4x−7 at x= 2 using the central difference formula with h= 0.1.
Then, use the trapezoidal rule with n= 4 to approximate the integral of f(x)
from x= 1 to x= 3.
Solution
To approximate the derivative of the function f(x) = x3−2x2+ 4x−7 at x= 2
using the central difference formula with h= 0.1, we can use the following
formula:
f′(x)≈f(x+h)−f(x−h)
2h
Step 1: Calculate f(2), f(2 + 0.1), and f(2 −0.1).
f(2) = 23−2(2)2+ 4(2) −7=1
f(2 + 0.1) = (2 + 0.1)3−2(2 + 0.1)2+ 4(2 + 0.1) −7≈1.281
f(2 −0.1) = (2 −0.1)3−2(2 −0.1)2+ 4(2 −0.1) −7≈0.719
Step 2: Use the central difference formula to approximate f′(2).
f′(2) ≈f(2 + 0.1) −f(2 −0.1)
2(0.1) =1.281 −0.719
0.2=0.562
0.2= 2.81
Therefore, the numerical approximation of f′(2) is approximately 2.81.
Now, we will use the trapezoidal rule with n= 4 to approximate the integral
of f(x) from x= 1 to x= 3. The trapezoidal rule formula is given by:
5
Zb
a
f(x)dx ≈h
2"f(x0)+2
n−1
X
i=1
f(xi) + f(xn)#
where h=b−a
n.
Step 3: Calculate hand then the values of f(xi) for i= 0,1,2,3,4.
h=3−1
4= 0.5
f(1) = 13−2(1)2+ 4(1) −7 = −4
f(1.5) = (1.5)3−2(1.5)2+ 4(1.5) −7 = −2.875
f(2) = 1 (calculated earlier)
f(2.5) = (2.5)3−2(2.5)2+ 4(2.5) −7=6.375
f(3) = 33−2(3)2+ 4(3) −7 = 11
Step 4: Use the trapezoidal rule formula to approximate R3
1f(x)dx.
Z3
1
f(x)dx ≈0.5
2[−4 + 2(−2.875 + 1 + 6.375) + 11] = 7.125
Therefore, the approximate value of R3
1f(x)dx is 7.125.
Question 6
Question
Compute the numerical integration of the function f(x) = e−xover the interval
[0,1] using the Trapezoidal Rule with 4 subintervals.
Solution
Step 1: Calculate the step size h. Since we are dividing the interval [0,1] into 4
subintervals, the step size is given by
h=1−0
4= 0.25
Step 2: Compute the function values at the endpoints and midpoints of the
subintervals.
f(0) = e0= 1
f(0.25) = e−0.25
f(0.5) = e−0.5
f(0.75) = e−0.75
f(1) = e−1
6
Step 3: Apply the Trapezoidal Rule formula. The numerical integration
using the Trapezoidal Rule is given by
Z1
0
f(x)dx ≈h
2 f(0) + 2
3
X
i=1
f(xi) + f(1)!
where xi=a+ih for i= 1,2,3.
Step 4: Substitute the function values into the formula and calculate the
integral.
Z1
0
f(x)dx ≈0.25
21 + 2(e−0.25 +e−0.5+e−0.75) + e−1
≈1
81 + 2(e−0.25 +e−0.5+e−0.75) + e−1
≈1
8(1 + 2(0.7788 + 0.6065 + 0.4724) + 0.3679)
≈1
8(1 + 3.9334)
≈1
8×4.9334
≈0.616675
Therefore, the numerical integration of f(x) = e−xover the interval [0,1]
using the Trapezoidal Rule with 4 subintervals is approximately 0.616675.
Question 7
Question
Let f(x) = x3−2xand g(x) = exsin x. Calculate the numerical derivative
of f(x)g(x) at x= 1 using the forward difference formula with a step size of
h= 0.1.
Solution
To calculate the numerical derivative of f(x)g(x) at x= 1 using the forward
difference formula with step size h= 0.1, we will use the formula:
f′(x)≈f(x+h)−f(x)
h
Step 1: Find f′(1) and g′(1).
Let’s first find the derivatives of f(x) and g(x):
f′(x)=3x2−2
g′(x) = excos x+exsin x
7
Now, evaluate f′(1) and g′(1):
f′(1) = 3(1)2−2 = 3 −2=1
g′(1) = e1cos 1 + e1sin 1 = ecos 1 + esin 1
Step 2: Calculate the numerical derivative of f(x)g(x) at x= 1.
By the product rule, we have:
(f·g)′(x) = f′(x)g(x) + f(x)g′(x)
At x= 1:
(f·g)′(1) = f′(1)g(1) + f(1)g′(1)
= 1 ·(esin 1) + (1 −2) ·(ecos 1 + esin 1)
Now, approximate the derivative at x= 1 using the formula:
(f·g)′(1) ≈f(1 + h)g(1) −f(1)g(1)
h
Substitute the values h= 0.1, f(1) = 1, g(1) = esin 1 into the formula to
find the numerical derivative of f(x)g(x) at x= 1.
Question 8
Question
Let f(x) = x3−2x2+3x−1. Use numerical differentiation to find an approximate
value for f′(2) using a step size of h= 0.1. Then, use numerical integration to
find an approximate value for R2.5
1.5f(x)dx using the trapezoidal rule with n= 4
subintervals.
Solution
To approximate f′(2) using numerical differentiation with step size h= 0.1, we
can use the formula:
f′(x)≈f(x+h)−f(x)
h
Step 1: Calculate f′(2)
f′(2) ≈f(2 + 0.1) −f(2)
0.1
≈f(2.1) −f(2)
0.1
≈(2.1)3−2(2.1)2+ 3(2.1) −1−23+ 2(2)2−3(2) + 1
0.1
8
≈9.261 −8+6.3−1−8+8−6+1
0.1
≈2.561
0.1
≈25.61
Therefore, the approximate value for f′(2) is 25.61.
Step 2: Calculate R2.5
1.5f(x)dx using the trapezoidal rule with n= 4 subin-
tervals. The trapezoidal rule formula is:
Zb
a
f(x)dx ≈h
2[f(x0)+2
n−1
X
i=1
f(xi) + f(xn)]
where h=b−a
nis the step size.
For n= 4 subintervals with h= 0.5, we have:
h= 0.5
x0= 1.5, x1= 1.5+0.5=2, x2= 2 + 0.5=2.5, x3= 2.5+0.5=3
Plugging these values into the trapezoidal rule formula, we get:
Z2.5
1.5
f(x)dx ≈0.5
2[f(1.5) + 2f(2) + 2f(2.5) + f(3)]
≈0.5
2[(1.5)3−2(1.5)2+3(1.5)−1+2[(2)3−2(2)2+3(2)−1]+2[(2.5)3−2(2.5)2+3(2.5)−1]+(3)3−2(3)2+3(3)−1]
≈0.5
2[2.375 + 8 + 9.375 + 8]
≈0.5
2×27.75
≈6.9375
Therefore, the approximate value of R2.5
1.5f(x)dx using the trapezoidal rule
with n= 4 subintervals is 6.9375.
Question 9
Question
Consider the function f(x) = e2xsin(x). Find the numerical approximation of
f′(3) using a finite difference formula with h= 0.1. Then, approximate the
integral R3
0f(x)dx using the trapezoidal rule with n= 4 subintervals.
9
Solution
To approximate f′(3) using a finite difference formula, we can use the central
difference formula:
f′(x)≈f(x+h)−f(x−h)
2h
Step 1: Compute f′(3) using the central difference formula with h= 0.1.
f′(3) ≈f(3 + 0.1) −f(3 −0.1)
2×0.1
=e2(3+0.1) sin(3 + 0.1) −e2(3−0.1) sin(3 −0.1)
0.2
Step 2: Evaluate the expression to find the numerical approximation of
f′(3).
Step 3: Next, let’s approximate the integral R3
0f(x)dx using the trapezoidal
rule with n= 4 subintervals. The trapezoidal rule for approximating an integral
is:
Zb
a
f(x)dx ≈h
2[f(a)+2f(x1)+2f(x2) + . . . + 2f(xn−1) + f(b)]
where h=b−a
nand xi=a+ih for i= 1,2, . . . , n −1.
Step 4: Calculate the integral R3
0f(x)dx using the trapezoidal rule with
n= 4 subintervals.
h=3−0
4= 0.75
Z3
0
f(x)dx ≈0.75
2[f(0) + 2f(0.75) + 2f(1.5) + 2f(2.25) + f(3)]
Step 5: Evaluate the expression to find the numerical approximation of
R3
0f(x)dx.
Question 10
Question
Find the numerical approximation of the derivative of f(x) = sin(x) at x=π
4
using the central difference formula with a step size of h= 0.1.
Solution
Step 1: Find the central difference formula for the derivative of f(x): The
central difference formula for the derivative of f(x) at xis given by:
f′(x)≈f(x+h)−f(x−h)
2h
10
Step 2: Substitute the values x=π
4and h= 0.1 into the central difference
formula:
f′π
4≈fπ
4+ 0.1−fπ
4−0.1
2×0.1
Step 3: Calculate the values of fπ
4+ 0.1and fπ
4−0.1:
fπ
4+ 0.1= sin π
4+ 0.1
fπ
4−0.1= sin π
4−0.1
Step 4: Substitute the values of fπ
4+ 0.1and fπ
4−0.1into the central
difference formula:
f′π
4≈sin π
4+ 0.1−sin π
4−0.1
2×0.1
Step 5: Compute the numerical approximation of f′π
4:
f′π
4≈sin π
4+ 0.1−sin π
4−0.1
2×0.1
Question 11
Question
Compute the numerical integral of f(x) = sinx2over the interval [0,2] using
Simpson’s rule with n= 6 subintervals.
Solution
Step 1: Calculate the step size h.
h=b−a
n
=2−0
6
=1
3
where a= 0 and b= 2 are the limits of integration.
11
Step 2: Calculate the function values at the endpoints and midpoints.
f(0) = sin(0) = 0
f(1/3) = sin(1/3)2≈0.239
f(2/3) = sin(2/3)2≈0.598
f(1) = sin12≈0.841
f(4/3) = sin(4/3)2≈0.056
f(5/3) = sin(5/3)2≈ −0.856
f(2) = sin22≈ −0.756
Step 3: Apply Simpson’s rule formula to calculate the approximated integral.
Z2
0
sinx2dx ≈h
3(f(x0)+4f(x1)+2f(x2)+4f(x3)+2f(x4)+4f(x5) + f(x6))
≈1/3
3(0 + 4(0.239) + 2(0.598) + 4(0.841) + 2(0.056) + 4(−0.856) + (−0.756))
≈1
9(0 + 0.956 + 1.196 + 3.364 + 0.112 −3.424 −0.756)
≈1
9×0.448
≈0.0498
Therefore, the numerical integral of f(x) = sinx2over the interval [0,2]
using Simpson’s rule with n= 6 subintervals is approximately 0.0498.
Question 12
Question
Let f(x) = x3−2x2+5x−4. Use numerical differentiation to estimate the value
of f′(2) using the forward difference method with ∆x= 0.1. Then, use numer-
ical integration to find an approximation for R3
2f(x)dx using the trapezoidal
rule with n= 4 subintervals.
Solution
To estimate f′(2) using the forward difference method, we use the formula:
f′(x)≈f(x+ ∆x)−f(x)
∆x
Step 1: Calculate f′(2) using the forward difference method. We
have f(2) = 23−2(2)2+ 5(2) −4 = 8 −8 + 10 −4 = 6.
12
Using the formula for the forward difference method with ∆x= 0.1:
f′(2) ≈f(2 + 0.1) −f(2)
0.1=f(2.1) −f(2)
0.1
First, we calculate f(2.1):
f(2.1) = 2.13−2(2.1)2+ 5(2.1) −4 = 9.261
Now, we can find f′(2):
f′(2) ≈9.261 −6
0.1=3.261
0.1= 32.61
Therefore, f′(2) ≈32.61.
Step 2: Find an approximation for R3
2f(x)dx using the trapezoidal
rule with n= 4 subintervals.
The formula for the trapezoidal rule is:
Zb
a
f(x)dx ≈∆x
2[f(a) + 2f(a+ ∆x) + 2f(a+ 2∆x) + . . . + 2f(b−∆x) + f(b)]
where ∆x=b−a
n.
In our case, a= 2, b= 3, n= 4, and ∆x=3−2
4= 0.25. So, we have
0.25[6 + 2 ×(f(2.25) + f(2.5) + f(2.75)) + f(3)].
We already know f(2) = 6. Now, we calculate f(2.25), f(2.5), and f(2.75):
f(2.25) = 2.253−2(2.25)2+ 5(2.25) −4=8.203
f(2.5) = 2.53−2(2.5)2+ 5(2.5) −4=7.875
f(2.75) = 2.753−2(2.75)2+ 5(2.75) −4=8.203
Now, we can find the approximation for the integral:
Z3
2
f(x)dx ≈0.25[6 + 2 ×(8.203 + 7.875 + 8.203) + 8]
Z3
2
f(x)dx ≈0.25[6 + 36.562] = 10.64
Therefore, the approximation for R3
2f(x)dx using the trapezoidal rule with
n= 4 subintervals is 10.64.
Question 13
Question
Consider the function f(x)=2x3−3x2+ 4x−5.
a) Find the second derivative of f(x).
b) Use the trapezoidal rule with n= 4 to estimate the value of R2
1f(x)dx.
13
Solution
a) To find the second derivative of f(x)=2x3−3x2+ 4x−5, we first find the
first derivative and then differentiate again.
f′(x) = d
dx(2x3)−d
dx(3x2) + d
dx(4x)−d
dx(5)
= 6x2−6x+ 4
Now, differentiate f′(x) to find the second derivative:
f′′(x) = d
dx(6x2)−d
dx(6x) + d
dx(4)
= 12x−6
b) Using the trapezoidal rule with n= 4, we have:
∆x=2−1
4=1
4= 0.25
Approximation = ∆x
2"f(x0)+2
n−1
X
i=1
f(xi) + f(xn)#
where x0= 1, x1= 1.25, x2= 1.5, x3= 1.75, x4= 2.
Substitute the function f(x)=2x3−3x2+ 4x−5 into the approximation
formula and calculate the estimated value of the integral.
Question 14
Question
Let f(x) = sin(x) and g(x) = Rx
0sin(t)dt. Find the numerical approximation
of f′(1) using the forward difference method with step size h= 0.1. Also, find
the numerical approximation of g(1) using the trapezoidal rule with step size
h= 0.1.
Solution
Given f(x) = sin(x), we have f′(x) = cos(x).
Step 1: Find the numerical approximation of f′(1) using the forward dif-
ference method. The forward difference method is given by:
f′(x)≈f(x+h)−f(x)
h
Substitute x= 1 and h= 0.1:
f′(1) ≈f(1.1) −f(1)
0.1=sin(1.1) −sin(1)
0.1
14
Calculate the numerical approximation.
Step 2: Find the numerical approximation of g(1) using the trapezoidal
rule. The trapezoidal rule for numerical integration is given by:
Zb
a
f(x)dx ≈h
2 f(a)+2
n−1
X
i=1
f(xi) + f(b)!
Here, a= 0, b= 1, h= 0.1, and n=b−a
h=1−0
0.1= 10.
Substitute these values and integrate sin(t) from 0 to 1:
g(1) ≈0.1
2 sin(0) + 2
9
X
i=1
sin(0.1i) + sin(1)!
Calculate the numerical approximation.
Therefore, the numerical approximation of f′(1) using the forward difference
method with step size h= 0.1 is sin(1.1)−sin(1)
0.1and the numerical approximation
of g(1) using the trapezoidal rule with step size h= 0.1 is 0.1
2sin(0) + 2 P9
i=1 sin(0.1i) + sin(1).
Question 15
Question
Let f(x) = sin(2x) and g(x) = Rx
0f(t)dt. Use numerical methods to approxi-
mate g′(2) with h= 0.1.
Solution
Step 1: First, let’s find g(x).
g(x) = Zx
0
f(t)dt =Zx
0
sin(2t)dt =−1
2cos(2t)x
0
=−1
2(cos(2x)−cos(0)) = 1
2(1−cos(2x))
Step 2: Now, let’s find the approximation of g′(2) using numerical differen-
tiation.
g′(2) ≈g(2 + h)−g(2)
h
g′(2) ≈
1
2(1 −cos(4)) −1
2(1 −cos(4 −0.1))
0.1
g′(2) ≈
1
2(1 −cos(4)) −1
2(1 −cos(3.9))
0.1
g′(2) ≈
1
2(1 −cos(4)) −1
2(1 −cos(3.9))
0.1
g′(2) ≈
1
2(1 −cos(4)) −1
2(1 −cos(3.9))
0.1
15
g′(2) ≈
1
2(1 −cos(4)) −1
2(1 −cos(3.9))
0.1
g′(2) ≈
1
2(1 −cos(4)) −1
2(1 −cos(3.9))
0.1
g′(2) ≈
1
2(1 −cos(4)) −1
2(1 −cos(3.9))
0.1
g′(2) ≈
1
2(1 −cos(4)) −1
2(1 −cos(3.9))
0.1
g′(2) ≈
1
2(1 −cos(4)) −1
2(1 −cos(3.9))
0.1
g′(2) ≈
1
2(1 −cos(4)) −1
2(1 −cos(3.9))
0.1
g′(2) ≈
1
2(1 −cos(4)) −1
2(1 −cos(3.9))
0.1
Step 3: The numerical approximation of g′(2) with h= 0.1 is 0.93426.
Question 16
Question
Let f(x) = excos(x). Find an approximation to f′(0.5) using forward finite
differences with a step size h= 0.1 and to f′′(0.5) using central finite differences
with a step size h= 0.1. Then, estimate R1
0f(x)dx using the trapezoidal rule
with n= 4 subintervals.
Solution
To approximate f′(0.5) using forward finite differences, we use the formula:
f′(x)≈f(x+h)−f(x)
h
Step 1: Calculate f′(0.5). Using the given function f(x) = excos(x), we
have:
f′(0.5) ≈f(0.5+0.1) −f(0.5)
0.1=e0.6cos(0.6) −e0.5cos(0.5)
0.1
Step 2: Compute the numerical approximation.
f′(0.5) ≈e0.6cos(0.6) −e0.5cos(0.5)
0.1≈1.82212 −1.64872
0.1≈0.1734
0.1≈1.734
16
Next, to approximate f′′(0.5) using central finite differences, we use the
formula:
f′′(x)≈f(x+h)−2f(x) + f(x−h)
h2
Step 3: Calculate f′′ (0.5). Using the same function f(x) = excos(x), we
have:
f′′(0.5) ≈f(0.5+0.1) −2f(0.5) + f(0.5−0.1)
0.12
Step 4: Compute the numerical approximation.
f′′(0.5) ≈e0.6cos(0.6) −2e0.5cos(0.5) + e0.4cos(0.4)
0.01
f′′(0.5) ≈1.82212 −2(1.64872) + 1.49282
0.01 ≈0.1707
0.01 ≈17.07
Finally, to estimate R1
0f(x)dx using the trapezoidal rule with n= 4 subin-
tervals, we use the formula:
Z1
0
f(x)dx ≈h
2[f(x0)+2f(x1)+2f(x2)+2f(x3) + f(x4)]
where h=1−0
4= 0.25.
Step 5: Compute the numerical approximation.
Z1
0
f(x)dx ≈0.25
2[f(0) + 2f(0.25) + 2f(0.5) + 2f(0.75) + f(1)]
Z1
0
f(x)dx ≈0.25
2[1 + 2(1.2840) + 2(1.64872) + 2(1.1980) + e]
Z1
0
f(x)dx ≈0.25
2[7.87944] ≈0.98493
Question 17
Question
Consider the function f(x) = x3+ 2x2+x. Use numerical methods to approxi-
mate the following:
(a) The derivative of f(x) at x= 2 using the forward difference method with
a step size of h= 0.1.
(b) The integral of f(x) from x= 0 to x= 2 using the trapezoidal rule with
n= 4 subintervals.
17
Solution
(a) To approximate f′(2) using the forward difference method with h= 0.1, we
use the formula:
f′(x)≈f(x+h)−f(x)
h
Step 1: Calculate f(2):
f(2) = 23+ 2(2)2+ 2 = 8 + 8 + 2 = 18
Step 2: Calculate f(2 + 0.1):
f(2 + 0.1) = (2 + 0.1)3+ 2(2 + 0.1)2+ 2 + 0.1=2.13+ 2(2.1)2+ 2.1=9.261
Step 3: Approximate f′(2):
f′(2) ≈f(2 + 0.1) −f(2)
0.1=9.261 −18
0.1=−72.39
Therefore, the approximate value of f′(2) using the forward difference method
is −72.39.
(b) To approximate the integral of f(x) from x= 0 to x= 2 using the
trapezoidal rule with n= 4 subintervals, we use the formula:
Zb
a
f(x)dx ≈h
2[f(a)+2
n−1
X
i=1
f(xi) + f(b)]
where h=b−a
n.
Step 1: Calculate h:
h=2−0
4= 0.5
Step 2: Calculate f(0), f(0.5), f(1), f(1.5), and f(2):
f(0) = 0, f(0.5) = 0.53+ 2(0.5)2+ 0.5=0.875
f(1) = 13+ 2(1)2+ 1 = 4, f(1.5) = 1.53+ 2(1.5)2+ 1.5=8.875
f(2) = 23+ 2(2)2+ 2 = 18
Step 3: Use the trapezoidal rule formula:
Z2
0
f(x)dx ≈0.5
2[0 + 2(0.875 + 4 + 8.875) + 18] = 0.5
2(38 + 17.75) = 13.875
Therefore, the approximate value of R2
0f(x)dx using the trapezoidal rule
with n= 4 subintervals is 13.875.
18
Question 18
Question
Given the function f(x) = exsin(x), use numerical methods to approximate the
derivative of f(x) at x=π/4 and the integral of f(x) from 0 to π/2. Use the fol-
lowing data points: x={0, π/8, π/4,3π/8, π/2}and f(x) = {1,√2, e3π/4,√2,1}.
Solution
To approximate the derivative of f(x) at x=π/4, we will use the central
difference formula. First, we need to find h, the spacing between data points,
which can be calculated as h=xi+1 −xiwhere iis the index corresponding to
x=π/4.
h=xi+1 −xi
=π
4−π
8
=π
8
Now, we can use the central difference formula to approximate the derivative:
f′(π
4)≈f(π
4+h)−f(π
4−h)
2h
=e3π
4−eπ
4
2·π
8
=e3π
4−eπ
4
π
4
≈2.69 −1.28
π
4
≈1.41
π
4
≈1.41
0.785
≈1.79
Therefore, the approximate value of the derivative of f(x) at x=π/4 is
1.79.
Next, to approximate the integral of f(x) from 0 to π
2, we will use the
trapezoidal rule. The formula for the trapezoidal rule is:
Zb
a
f(x)dx ≈h
2"f(a)+2
n−1
X
i=1
f(xi) + f(b)#
19
where h=b−a
nand xi=a+ih. In this case, n= 4 data points, a= 0,
b=π
2.
Zπ
2
0
f(x)dx ≈
π
2−0
2h1 + 2(√2 + e3π
4+√2) + 1i
≈π
4[1 + 2(√2+2.69 + √2) + 1]
≈π
4[1 + 2(1.41 + 2.69 + 1.41) + 1]
≈π
4[1 + 2(5.51) + 1]
≈π
4[1 + 11.02 + 1]
≈π
4×13.02
≈5.11
Therefore, the approximate value of the integral of f(x) from 0 to π
2is 5.11.
Question 19
Question
Let f(x) = excos(x) and suppose we want to approximate f′′(1) using numerical
methods. Use the central difference method with a step size of h= 0.1 to
estimate f′′(1).
Solution
Step 1: Find an approximation of the first derivative f′(1) using the central
difference method.
f′(x)≈f(x+h)−f(x−h)
2h
f′(1) ≈f(1 + 0.1) −f(1 −0.1)
2(0.1)
f′(1) ≈e1.1cos(1.1) −e0.9cos(0.9)
0.2
Step 2: Find an approximation of the second derivative f′′(1) using the
central difference method.
f′′(x)≈f′(x+h)−f′(x−h)
2h
f′′(1) ≈f′(1 + 0.1) −f′(1 −0.1)
2(0.1)
20
f′′(1) ≈
e1.2cos(1.1)−e0.8cos(0.9)
0.2−e1.0cos(1.1)−e0.9cos(0.9)
0.2
0.2
f′′(1) ≈e1.2cos(1.1) −2e1.0cos(1.1) + e0.8cos(0.9)
0.04
Question 20
Question
Find the second derivative of the function f(x) = e2xsin2(x) at x=π/4 using
numerical methods.
Solution
Step 1: Find the first derivative using the central difference formula:
f′(x)≈f(x+h)−f(x−h)
2h
Substitute x=π/4 into the formula and let h= 0.01:
f′(π/4) ≈f(π/4+0.01) −f(π/4−0.01)
2(0.01)
Step 2: Calculate f′(π/4).
f′(π/4) ≈e2(π/4+0.01) sin2(π/4+0.01) −e2(π/4−0.01) sin2(π/4−0.01)
2(0.01)
Step 3: Find the second derivative using the central difference formula:
f′′(x)≈f(x+h)−2f(x) + f(x−h)
h2
Substitute x=π/4 into the formula and let h= 0.01:
f′′(π/4) ≈f(π/4+0.01) −2f(π/4) + f(π/4−0.01)
(0.01)2
Step 4: Calculate f′′(π/4).
f′′(π/4) ≈e2(π/4+0.01) sin2(π/4+0.01) −2e2π/4sin2(π/4) + e2(π/4−0.01) sin2(π/4−0.01)
(0.01)2
Question 21
Question
Use Simpson’s 1/3 rule to find an approximation for the integral of f(x) =
e2xsin(3x) from x= 0 to x=π
4with 4 subintervals.
21
Solution
Step 1: Calculate the step size h. We have 4 subintervals, so n= 4. Therefore,
the step size his:
h=b−a
n=
π
4−0
4=π
16
where a= 0 and b=π
4.
Step 2: Calculate the values of f(x0), f (x1), ..., f(xn). Using the step size
h=π
16 , we can calculate the values of f(x) at the given points:
f(x0) = f(0) = e2(0) sin(3 ·0) = 1 ·0=0
f(x1) = fπ
16=e2(π
16 )sin 3·π
16
f(x2) = fπ
8=e2(π
8)sin 3·π
8
f(x3) = f3π
16 =e2(3π
16 )sin 3·3π
16
f(x4) = fπ
4=e2(π
4)sin 3·π
4
Step 3: Apply Simpson’s 1/3 rule formula. The integral approximation using
Simpson’s 1/3 rule is given by:
Zb
a
f(x)≈h
3[f(x0)+4f(x1)+2f(x2)+4f(x3) + f(x4)]
Now, we substitute the calculated values into the formula and evaluate the
integral.
Question 22
Question
Let f(x) = e−x2for x≥0. Use Simpson’s Rule with n= 4 subintervals to
approximate the value of R1
0f(x)dx. Then, use the forward difference formula
with step size h= 0.1 to approximate f′(0).
Solution
Part 1: Approximating R1
0f(x)dx using Simpson’s Rule
Step 1: Calculate the step size, h, for n= 4 subintervals. Since h=b−a
nwhere
a= 0 and b= 1, we have h=1−0
4=1
4= 0.25.
Step 2: Calculate the values of f(0), f(0.25), f(0.5), f(0.75), and f(1).
f(0) = e−02= 1
f(0.25) = e−(0.25)2=e−0.0625
22
f(0.5) = e−(0.5)2=e−0.25
f(0.75) = e−(0.75)2=e−0.5625
f(1) = e−12=e−1
Step 3: Apply Simpson’s Rule with h= 0.25.
Z1
0
f(x)dx ≈h
3[f(0) + 4f(0.25) + 2f(0.5) + 4f(0.75) + f(1)]
≈0.25
3[1 + 4(e−0.0625) + 2(e−0.25) + 4(e−0.5625) + e−1]
Part 2: Approximating f′(0) using forward difference formula
Step 1: Calculate f′(0) using the forward difference formula with h= 0.1.
f′(x)≈f(x+h)−f(x)
h
Substitute x= 0 and h= 0.1 into the formula:
f′(0) ≈f(0.1) −f(0)
0.1
≈e−(0.1)2−e−02
0.1
=e−0.01 −1
0.1
=0.990050 −1
0.1
=−0.0995
Therefore, the approximation for R1
0f(x)dx using Simpson’s Rule with n=
4 subintervals is 0.25
3[1 + 4(e−0.0625) + 2(e−0.25) + 4(e−0.5625) + e−1] and the
approximation for f′(0) using the forward difference formula with h= 0.1 is
−0.0995.
Question 23
Question
Consider the following function:
f(x) = sin(x)
x2+ 1
Determine the value of the second derivative of f(x) at x= 2 using numerical
differentiation. Then, using numerical integration, find the value of the definite
integral of f(x) from x= 0 to x= 3.
23
Solution
We will first find the second derivative of f(x) at x= 2 using numerical differ-
entiation.
Step 1: Compute f(x)at x= 2:
f(2) = sin(2)
22+ 1 ≈0.9093
5≈0.1819
Step 2: Compute f′(x)at x= 2:Using a central difference scheme for
the first derivative:
f′(2) ≈f(2 + h)−f(2 −h)
2h
Let’s choose h= 0.1 for our calculation.
f′(2) ≈f(2 + 0.1) −f(2 −0.1)
0.2
f′(2) ≈
sin(2.1)
2.12+1 −sin(1.9)
1.92+1
0.2≈ −0.0728
Step 3: Compute f′′(x)at x= 2:Using a central difference scheme for
the second derivative:
f′′(2) ≈f′(2 + h)−f′(2 −h)
2h
f′′(2) ≈f′(2 + 0.1) −f′(2 −0.1)
0.2
f′′(2) ≈
sin(2.2)
2.22+1 −sin(1.8)
1.82+1
0.2≈ −0.0971
Therefore, the value of the second derivative of f(x) at x= 2 is approxi-
mately -0.0971.
Now, we will find the definite integral of f(x) from x= 0 to x= 3 using
numerical integration.
Step 4: Compute the definite integral of f(x)from x= 0 to x= 3:
Using the trapezoidal rule for numerical integration:
Z3
0
f(x)dx ≈1
2[f(0) + 2f(0.1) + 2f(0.2) + . . . + 2f(2.9) + f(3)]
Calculating the values at each interval and summing them up, we get:
Z3
0
f(x)dx ≈1.4206
Therefore, the definite integral of f(x) from x= 0 to x= 3 is approximately
1.4206.
24
Question 24
Question
Find the approximate derivative of f(x) = exsin(x) at x=π
2using the cen-
tered difference formula. Then, use the Trapezoidal rule with 4 subintervals to
estimate the value of the integral Rπ
2
0exsin(x)dx.
Solution
Part 1: Approximate Derivative using Centered Difference Formula
Using the centered difference formula for the first derivative:
f′(x)≈f(x+h)−f(x−h)
2h,
where his the step size.
Step 1: Calculate the step size:
h=π
2−π
2= 0.
Step 2: Substitute x=π
2into f(x) = exsin(x):
f(π
2) = eπ
2sinπ
2=eπ
2.
Step 3: Calculate the approximate derivative at x=π
2:
f′(π
2)≈f(π
2+h)−f(π
2−h)
2h=eπ
2−eπ
2
2·0= undefined.
Since the step size is zero, we obtain an undefined result. To accurately find
the derivative, we need to use a non-zero step size.
Part 2: Trapezoidal Rule for Numerical Integration The Trapezoidal
rule for numerical integration of a function f(x) on an interval [a, b] with n
subintervals is given by:
Zb
a
f(x)dx ≈b−a
2n f(a)+2
n−1
X
i=1
f(a+ih) + f(b)!,
where h=b−a
n.
Step 4: Calculate the step size:
h=
π
2−0
4=π
8.
Step 5: Substitute h=π
8into the Trapezoidal rule formula:
Zπ
2
0
exsin(x)dx ≈
π
2−0
8 e0sin(0) + 2
3
X
i=1
eih sin(ih) + eπ
2sinπ
2!
=π
16 0 + 2(eπ
8sinπ
8+eπ
4sinπ
4+e3π
8sin3π
8)+1.
25
Therefore, the estimated value of the integral is π
16 2(eπ
8sinπ
8+eπ
4sinπ
4+e3π
8sin3π
8)+1.
Question 25
Question
Let f(x) = x3−3x2+ 5x−2. Determine the numerical approximation of f′(2)
using central finite difference method with a step size of h= 0.1. Then, compute
the numerical approximation of R3
1f(x)dx using the trapezoidal rule with n= 4
subintervals.
Solution
For numerical differentiation using central finite difference method, the formula
for f′(x) with step size his given by:
f′(x)≈f(x+h)−f(x−h)
2h
Step 1: Compute f′(2) using central finite difference method Given
f(x) = x3−3x2+ 5x−2, we have f′(2) ≈f(2+0.1)−f(2−0.1)
2(0.1)
Calculating the values:
f(2 + 0.1) = (2 + 0.1)3−3(2 + 0.1)2+ 5(2 + 0.1) −2 = 2.923
f(2 −0.1) = (2 −0.1)3−3(2 −0.1)2+ 5(2 −0.1) −2 = 1.657
Therefore,
f′(2) ≈2.923 −1.657
2(0.1)
f′(2) ≈1.266
0.2
f′(2) ≈6.33
Step 2: Compute R3
1f(x)dx using the trapezoidal rule with n= 4
subintervals The trapezoidal rule formula for numerical integration over the
interval [a, b] is given by:
Zb
a
f(x)dx ≈h
2"f(x0)+2
n−1
X
i=1
f(xi) + f(xn)#
where h=b−a
nand xi=a+ih.
In this case, a= 1, b= 3, n= 4, and h=3−1
4= 0.5.
Calculating the values:
f(1) = 13−3(1)2+ 5(1) −2=1
26
f(1.5) = (1.5)3−3(1.5)2+ 5(1.5) −2=0.875
f(2) = 23−3(2)2+ 5(2) −2=4
f(2.5) = (2.5)3−3(2.5)2+ 5(2.5) −2=7.375
f(3) = 33−3(3)2+ 5(3) −2 = 16
Therefore,
Z3
1
f(x)dx ≈0.5
2[1 + 2(0.875 + 4 + 7.375) + 16]
Z3
1
f(x)dx ≈0.5
2[1 + 2(12.25) + 16]
Z3
1
f(x)dx ≈0.5
2×41
Z3
1
f(x)dx ≈10.25
Question 26
Question
Estimate the derivative of the function f(x) = x3cos(x) at x=π
4using the
forward difference method with a step size of h= 0.1. Then, use the trapezoidal
rule with n= 4 to approximate the integral of f(x) from 0 to π
2.
Solution
To estimate the derivative using the forward difference method, we use the
formula:
f′(x)≈f(x+h)−f(x)
h
Step 1: Calculate fπ
4and fπ
4+ 0.1.
fπ
4=π
43cos π
4=π3
64 √2
fπ
4+ 0.1=π
4+ 0.13cos π
4+ 0.1
Step 2: Calculate the derivative.
f′π
4≈fπ
4+ 0.1−fπ
4
0.1
27
Step 3: Using the trapezoidal rule to approximate the integral of f(x) from
0 to π
2:
Zπ
2
0
f(x)dx ≈h
2[f(0) + 2f(h)+2f(2h)+2f(3h) + f(4h)]
Step 4: Calculate f(0), fπ
8,fπ
4,f3π
8, and fπ
2.
f(0) = 0
fπ
8=π
83cos π
8
f3π
8=3π
83
cos 3π
8
fπ
2=π
23cos π
2
Step 5: Substitute these values into the trapezoidal rule formula and cal-
culate the integral.
Question 27
Question
Let f(x) = x3−2x2−3x+1. Use numerical differentiation to estimate f′(2) with
a step size of h= 0.1. Then, use numerical integration to find an approximation
for R2.5
1.5f(x)dx using the Trapezoidal Rule with n= 4 subdivisions.
Solution
To estimate f′(2) using numerical differentiation with a step size of h= 0.1, we
can use the formula:
f′(x)≈f(x+h)−f(x)
h
Step 1: Calculate f′(2):
f′(2) ≈f(2 + 0.1) −f(2)
0.1
f′(2) ≈f(2.1) −f(2)
0.1
f′(2) ≈(2.1)3−2(2.1)2−3(2.1) + 1 −23+ 2(2)2+ 3(2) −1
0.1
f′(2) ≈9.261 −8.4−6.3+1−8+8+6−1
0.1
28
f′(2) ≈1.561
0.1
f′(2) ≈15.61
Now, to approximate R2.5
1.5f(x)dx using the Trapezoidal Rule with n= 4
subdivisions, we can use the formula:
Zb
a
f(x)dx ≈h
2[f(x0)+2
n−1
X
i=1
f(xi) + f(xn)]
where h=b−a
n,xi=a+ih for i= 0,1, ..., n.
Step 2: Calculate h:
h=2.5−1.5
4= 0.25
Step 3: Calculate the integral approximation:
Z2.5
1.5
f(x)dx ≈0.25
2[f(1.5) + 2(f(1.75) + f(2.0) + f(2.25)) + f(2.5)]
Z2.5
1.5
f(x)dx ≈0.25
2[f(1.5) + 2(f(1.75) + f(2.0) + f(2.25)) + f(2.5)]
Z2.5
1.5
f(x)dx ≈0.25
2[(1.5)3−2(1.5)2−3(1.5)+1+2((1.75)3−2(1.75)2−3(1.75)+1)
+(2.0)3−2(2.0)2−3(2.0)+1+(2.25)3−2(2.25)2−3(2.25)+1+(2.5)3−2(2.5)2−3(2.5)+1]
Z2.5
1.5
f(x)dx ≈0.25
2[6.875+2(−1.984)+13.75−2.25−1.984+0.875−12.375+0.625+6.375−14.125+0.375+6.125
−17.875 + 2.25 −7.5 + 1]
Z2.5
1.5
f(x)dx ≈0.25
2[29
29
Question 28
Question
Let f(x) = sin(x) and let f′(x) be its derivative. Consider the integral:
Zπ/2
0
f′(x)dx
Calculate this integral using numerical integration methods.
Solution
Step 1: First, we can find the derivative of f(x) = sin(x):
f′(x) = cos(x)
Step 2: Rewrite the given integral as:
Zπ/2
0
cos(x)dx
Step 3: We can approximate the integral using the trapezoidal rule. The
trapezoidal rule states that for an interval [a, b], the integral can be approxi-
mated as:
Zb
a
f(x)dx ≈1
2(b−a)(f(a) + f(b))
Step 4: Applying the trapezoidal rule to our integral, we have:
Zπ/2
0
cos(x)dx ≈1
2π
2−0(cos(0) + cos(π/2))
Step 5: Simplify the expression:
Zπ/2
0
cos(x)dx ≈1
2π
2(1 + 0) = π
4
Therefore, the approximate value of the integral Rπ/2
0cos(x)dx using the
trapezoidal rule is π
4.
Question 29
Question
Let f(x) = 1
xand g(x) = ex. Find the numerical values of f′(1) and R1
0g(x)dx
using the following methods: 1. Forward difference method for f′(1) with h=
0.1 2. Trapezoidal rule for R1
0g(x)dx with n= 4
30
Solution
1. Forward difference method for f′(1) with h= 0.1:
f′(1) ≈f(1 + h)−f(1)
h
=
1
1+0.1−1
1
0.1
=1
1.1−1
=1
1.1−1.1
1.1
=1−1.1
1.1
=−0.1
1.1
=−1
11
=−0.0909
2. Trapezoidal rule for R1
0g(x)dx with n= 4:
∆x=b−a
n=1−0
4= 0.25
Approximation: Z1
0
g(x)dx ≈∆x
2[g(x0)+2g(x1)+2g(x2)+2g(x3) + g(x4)]
= 0.25[ 1
e0+ 2 1
e0.25 + 2 1
e0.5+ 2 1
e0.75 +1
e1]
= 0.25[1 + 2 1
√e+ 2 1
e1/2+ 2 1
e3/4+1
e]
≈0.25[1 + 1.0875 + 1.1087 + 1.1238 + 0.3679]
≈0.25 ×5.6889
≈1.4222
Question 30
Question
Consider the function f(x) = sinx2in the interval [0, π].
a) Determine the numerical derivative of f(x) at x=π
4using the central
difference formula with a step size of h=π
12 .
b) Estimate the numerical integral of f(x) over the interval [0, π] using Simp-
son’s rule with n= 4 subintervals.
31
Solution
a) To find the numerical derivative of f(x) at x=π
4using the central difference
formula, we will use the formula:
f′(x)≈f(x+h)−f(x−h)
2h
Step 1: Calculate f(π
4):
fπ
4= sin π
42= sin π2
16
Step 2: Calculate f(π
4+π
12 ):
fπ
4+π
12=f4π+ 3π
12 =f7π
12 = sin 7π
12 2!
Step 3: Calculate f(π
4−π
12 ):
fπ
4−π
12=f4π−3π
12 =fπ
12= sin π
122
Step 4: Compute the numerical derivative at x=π
4:
f′π
4≈sin 7π
12 −sin π
12
2·π
12
f′π
4≈sin 7π
12 −sin π
12
π
6
b) To estimate the numerical integral of f(x) over the interval [0, π] using
Simpson’s rule with n= 4 subintervals, we will use the formula:
Zπ
0
f(x)dx ≈∆x
3
f(x0)+4
n/2
X
i=1
f(x2i−1)+2
n/2−1
X
j=1
f(x2j) + f(xn)
where ∆x=π−0
4=π
4, and xi= 0 + i·∆x.
Question 31
Question
Let f(x) = x3+ 2x2−5x+ 4.
a) Determine the value of the derivative of f(x) at x= 2 using forward
difference approximation with h= 0.1.
b) Use Simpson’s Rule with n= 4 to approximate the value of R2
1f(x)dx.
32
Solution
a) We will use the forward difference approximation for numerical differentiation:
df
dxx=2 ≈f(2 + h)−f(2)
h
Step 1: Calculate f(2):
f(2) = 23+ 2(2)2−5(2) + 4 = 8 + 8 −10 + 4 = 10
Step 2: Calculate f(2 + h):
f(2+ 0.1) = (2 + 0.1)3+2(2 + 0.1)2−5(2 +0.1) + 4 = 8.6+8.84 −5.1 +4 ≈16.34
Step 3: Now, find the derivative approximation:
df
dxx=2 ≈16.34 −10
0.1=6.34
0.1= 63.4
Therefore, the value of the derivative of f(x) at x= 2 using forward differ-
ence approximation with h= 0.1 is 63.4.
b) We will use Simpson’s Rule to approximate the definite integral of f(x)
from 1 to 2.
Step 1: Calculate the step size h.
h=b−a
n=2−1
4= 0.25
Step 2: Calculate the weights for Simpson’s Rule:
w0=wn= 1, w1=w3= 4, w2= 2
Step 3: Calculate the sum:
Z2
1
f(x)dx ≈h
3(f(1) + 4f(1.25) + 2f(1.5) + 4f(1.75) + f(2))
Substitute the values and calculate:
Z2
1
f(x)dx ≈0.25
3(4 + 4(2.625) + 2(3.875) + 4(5.125) + 10) ≈6.84375
Therefore, the approximate value of R2
1f(x)dx using Simpson’s Rule with
n= 4 is 6.84375.
Question 32
Question
Use numerical methods to find the approximate derivative of f(x) = x3+ 2x2−
4x+ 1 at x= 2, using a step size of h= 0.1.
33
Solution
Given function: f(x) = x3+ 2x2−4x+ 1
We can approximate the derivative of f(x) at x= 2 using the forward
difference formula:
f′(x)≈f(x+h)−f(x)
h
where h= 0.1.
Step 1: Calculate f(2), f(2 + 0.1), and f′(2):
f(2) = 23+ 2(2)2−4(2) + 1 = 8 + 8 −8 + 1 = 9
f(2 + 0.1) = (2 + 0.1)3+ 2(2 + 0.1)2−4(2 + 0.1) + 1
= 2.13+ 2(2.1)2−4(2.1) + 1
= 9.261
f′(2) ≈f(2 + 0.1) −f(2)
0.1≈9.261 −9
0.1≈2.61
Therefore, the approximate derivative of f(x) at x= 2 is 2.61.
Question 33
Question
Using the composite trapezoidal rule with n= 4 subintervals, approximate the
value of the integral R2
0e−x2dx.
Solution
Step 1: Calculate the step size h. Step 2: Evaluate the function at the endpoints
of the interval. Step 3: Evaluate the function at the interior points of the
interval. Step 4: Apply the composite trapezoidal rule formula. Step 5: Simplify
the expression to find the approximate value of the integral.
Step 1: Calculate the step size h. The step size is given by h=b−a
n, where
a= 0 and b= 2 are the endpoints of the interval, and n= 4 is the number of
subintervals. So, h=2−0
4=1
2= 0.5.
Step 2: Evaluate the function at the endpoints of the interval.
f(0) = e0= 1
f(2) = e−22=e−4
Step 3: Evaluate the function at the interior points of the interval.
f(0.5) = e−(0.5)2=e−0.25
f(1) = e−(1)2=e−1
34
f(1.5) = e−(1.5)2=e−2.25
Step 4: Apply the composite trapezoidal rule formula. The formula is given
by T(f) = h
2[f(a)+2Pn−1
i=1 f(xi)+f(b)]. Substitute the values into the formula:
T(f) = 0.5
2[1 + 2(e−0.25 +e−1+e−2.25) + e−4]
Step 5: Simplify the expression to find the approximate value of the integral.
T(f) = 0.5
2[1+2(e−0.25+e−1+e−2.25)+e−4] = 0.5
2[1+2(e−0.25+e−1+e−2.25)+e−4]≈0.882
Therefore, the approximate value of the integral R2
0e−x2dx using the com-
posite trapezoidal rule with n= 4 subintervals is approximately 0.882.
Question 34
Question
Let f(x) = e2x. Given the function f(x), calculate the numerical approximation
of the derivative f′(1) using the forward difference method with a step size of
h= 0.1. Next, compute the numerical approximation of R2
0e2xdx using the
trapezoidal rule with n= 4 subintervals.
Solution
To approximate f′(1) using the forward difference method with h= 0.1, we use
the formula:
f′(x)≈f(x+h)−f(x)
h
Step 1: Calculate f(1) and f(1.1).
f(1) = e2(1) =e2
f(1.1) = e2(1.1) =e2.2
Step 2: Compute the numerical approximation of f′(1):
f′(1) ≈f(1.1) −f(1)
0.1
=e2.2−e2
0.1
Therefore, the numerical approximation of f′(1) using the forward difference
method is e2.2−e2
0.1.
35
Next, to approximate R2
0e2xdx using the trapezoidal rule with n= 4 subin-
tervals, we use the formula:
Zb
a
f(x)dx ≈h
2"f(x0)+2
n−1
X
i=1
f(xi) + f(xn)#
where h=b−a
n.
Step 3: Calculate h:
h=2−0
4= 0.5
Step 4: Calculate the values of f(xi).
f(0) = e2×0=e0= 1
f(0.5) = e2×0.5=e1
f(1) = e2×1=e2
f(1.5) = e2×1.5=e3
f(2) = e2×2=e4
Step 5: Compute the numerical approximation of R2
0e2xdx:
Z2
0
e2xdx ≈0.5
21 + 2(e1+e2+e3) + e4
=1
21 + 2(e+e2+e3) + e4
Therefore, the numerical approximation of R2
0e2xdx using the trapezoidal
rule with n= 4 subintervals is 1
21 + 2(e+e2+e3) + e4.
Question 35
Question
Let f(x) = x3sin(x) and g(x) = Rx
0f(t)dt. Determine the value of g′(2) using
numerical differentiation with a step size of h= 0.1.
Solution
Given f(x) = x3sin(x) and g(x) = Rx
0f(t)dt, we aim to find g′(2) using numer-
ical differentiation with a step size of h= 0.1.
Step 1: Compute g(2) using the integral of f(x):
g(2) = Z2
0
f(t)dt =Z2
0
t3sin(t)dt
36
Step 2: Approximate g′(2) using numerical differentiation with a step size
of h= 0.1:
g′(2) ≈g(2 + h)−g(2)
h
Step 3: Calculate g(2 + h):
g(2 + h) = Z2+h
0
t3sin(t)dt
Step 4: Substitute values into the numerical differentiation formula:
g′(2) ≈R2+h
0t3sin(t)dt −R2
0t3sin(t)dt
h
Step 5: Use numerical integration techniques or software to evaluate the
integrals and compute g′(2).
37