Homework 3-Answer Key
Homework 3-Answer Key
Practice problems -Homework due before midnight 11/11/2023 at Canvas. Please only use a
writing processing software such as Word for writing- no handwritten homework will be
accepted!
Question 1:
3
During a lab experiment, the height of a palm tree increased at a rate of (2𝑡 + 5)−4 cm
per day, where t represents the number of days since the start of the experiment.
(a) If the tree was 31 cm high at the beginning (𝑡 = 0), what would its height be after 10
days?
(b) When will the height of the tree be 43 cm?
(c) What’s the height change from day 20 to day 80?
(d) What is the error in the height measurement after 100 ± 0.1 days from t=0?
Solution:
(a)
3
𝑟(𝑡) = (2𝑡 + 5)−4
3 1
h(t) = ∫(2t + 5)−4 dt = 2(2t + 5)4 + c
1
h(0) = 2(2 ⋅ 0 + 5)4 + c = 31 → c = 28.0093
1
h(10) = 2(2 ⋅ 10 + 5)4 + 28.0093 = 32.4814 cm
1
(b) 2(2t̅ + 5)4 + 28.0093 = 43 → t̅ = 1575.611 da𝑦𝑠
3 1 1
80
(c) ∫20 (2t + 5)−4 = [ 2(2x80 + 5)4 + 28] − [2(2x20 + 5)4 + 28] = 1.988 cm
2
∂h 2 3 3
(d) σh = √( ∂t ) σ2t = √((2 ∗ 100 + 5)−4 ) ∗ 0.12 = (2 ∗ 100 + 5)−4 ∗ 0.1 = 0.0018
Question 2:
Given the function
𝑓(𝑥) = 𝑥3 − 4𝑥2 − 6𝑥 – 2
• Approximate the derivative at x = 2 for the step sizes h = 0.01 and h= 0.001.
𝑓(𝑥 + h) − 𝑓(𝑥)
𝑓 ′ (𝑥) = lim
ℎ→h h
3 2
′ (𝑥)
((𝑥 + ℎ) − 4(𝑥 + ℎ) − 6(𝑥 + h) − 2) − (𝑥 3 − 4𝑥 2 − 6𝑥 − 2)
𝑓 = lim
ℎ→h h
For h = 0.01
𝑓(2.01) − 𝑓(2)
𝑓 ′ (2) = lim
ℎ→0.01 0.01
3 2
((2.01) − 4(2.01) − 6(2.01) − 2) − (23 − 4(2)2 − 6(2) − 2)
𝑓 ′ (2) = lim
ℎ→0.01 0.01
𝑓 ′ (2) = −9.9799
For h = 0.001
𝑓(2 + 0.01) − 𝑓(2)
𝑓 ′ (2) = lim
ℎ→0.001 0.001
3 2
((2.001) − 4(2.001) − 6(2.001) − 2) − (23 − 4(2)2 − 6(2) − 2)
𝑓 ′ (2) = lim
ℎ→0.001 0.001
𝑓 ′ (2) = −9.997999
This occurs when the error decreases proportionally to the number of subdivisions. In
other words, doubling the number of subdivisions (increasing h halves the error. This is
typical for simpler numerical methods or methods applied to functions that are not
sufficiently smooth.
• Approximate the derivative at x = 2 for the step sizes h = 0.01 and h= 0.001.
Using central scheme:
For h = 0.01
((2 + 0.01)3 − 4(2 + 0.01)2 − 6(2 + 0.01) − 2 − ((2 − 0.01)3 − 4(2 − 0.01)2 − 6(2 − 0.01) − 2))
𝑓 ′ (2) = lim
ℎ→0.01 0.01
= −9.9999
For h = 0.001
((2 + 0.001)3 − 4(2 + 0.001)2 − 6(2 + 0.001) − 2 − ((2 − 0.001)3 − 4(2 − 0.001)2 − 6(2 − 0.001) − 2))
𝑓 ′ (2) = lim
ℎ→0.001 0.001
= −9.999999
• Calculate the associated error for each step size ℎ.
This is observed when the error decreases with the square of the number of subdivisions.
For example, doubling h would reduce the error by a factor of four. The trapezoidal rule
and Simpson's rule often exhibit quadratic convergence for functions that are sufficiently
smooth (i.e., have continuous second derivatives).
Question 3:
Given the function:
𝑓(𝑥) = 𝑒−𝑥2
(a) Apply the trapezoidal rule to estimate the definite integral of f(x) over the interval [−1,1]
using n = 2, n= 4, and n=6.
1 𝑏−𝑎
∫−1 ⅇ−𝑥2 𝑑𝑥 Δ𝑥 = 𝑛
Δ𝑥
𝑇𝑛 = [𝑓(𝑥0 ) + 2𝑓(𝑥1 ) … + 2𝑓(𝑥𝑛−1 ) + 𝑓(𝑥𝑛 )]
2
For n=2
1 − (−1)
Δ𝑥 = =1
2
−1,0,1
1
𝑇2 = [𝑓(−1) + 2𝑓(0) + 𝑓(−1)]
2
1 −(−1)2 2 2
𝑇2 = [ⅇ + 2ⅇ−(0) + ⅇ−(1) ]
2
𝑻𝟐 = 𝟏. 𝟑𝟔𝟕𝟖𝟕𝟗
For n=4
1 − (−1)
Δ𝑥 = = 0.5
4
−1, −0.5,0,0.5,1
0.5
𝑇4 = [𝑓(−1) + 2𝑓(−0.5) + 2𝑓(0) + 2𝑓(0.5) + 𝑓(−1)]
2
1 −(−1)2 2 2 2 2
𝑇4 = [ⅇ + 2ⅇ−(−0.5) + 2ⅇ−(0) + 2ⅇ−(0.5) + ⅇ−(1) ]
4
𝑻𝟒 = 𝟏. 𝟒𝟔𝟐𝟕𝟒
For n=6
1 − (−1) 1
Δ𝑥 = =
6 6
−1, − 2⁄3 , , − 1⁄3 , 0, 1⁄3 , 2⁄3 , 1
1⁄
𝑇6 = 3 [𝑓(−1) + 2𝑓(− 2⁄3) + 2𝑓(− 1⁄3) + 2𝑓(0) + 2𝑓(1⁄3) + 2𝑓(2⁄3) + 𝑓(−1)]
2
1 −(−1)2 2 2 1 2 2 1 2 2 2 2
𝑇6 = [ⅇ + 2ⅇ−(− ⁄3) + 2ⅇ−(− ⁄3) + 2ⅇ−(0) + 2ⅇ−( ⁄3) + 2ⅇ−( ⁄3) + ⅇ−(1) ]
6
𝑻𝟔 = 𝟏. 𝟒𝟕𝟗𝟗𝟕𝟐
Computed Errors: The absolute difference between the trapezoidal rule approximation and the
exact value of the integral I=1.49364.
Estimated Error: The estimated error for the trapezoidal rule is given by:
(𝑏 − 𝑎)3
𝐸𝑟𝑟𝑜𝑟: 𝐸(∆𝑥) = 𝑀
12𝑛 2
𝑀 ≥ |𝑓′′(𝑥)|
Consider the function 𝑓(𝑥) = 𝑐𝑜𝑠(𝑥2) on the interval [𝑎, 𝑏] = [0, 𝜋].
(a) Determine the number of intervals (n) needed for Simpson's rule to achieve a desired
precision of 10−4 and
(b) Calculate the solution using that interval
(c) Compare your numerical solution to the exact solution.
Solution:
𝑓′(𝑥) = −2x sin(𝑥 2 )
(𝑏 − 𝑎)5
𝐸(∆𝑥) = 𝑀
180𝑛4
𝑀 ≥ |𝑓 (4) (𝑥)|
𝐸(∆𝑥) = 0.0001
In order to maximize the fourth derivative, we need to find the absolute value of the global
extremum of the function in the interval [0, 𝝅]. Analytically this can be found using the 1st
derivative test (5th derivative in this example since deriving the fourth derivative will yield the
5th derivative). Since 𝑓4(𝑥) is complicated, we rely on a graphical interpretation of the function.
(𝜋 − 0)5
(1601.2) = 0.0001
180𝑛4
(𝜋)5 × (1601.2)
= 0.0001
180𝑛 4
(𝜋)5 × (1601.2)
= 𝑛4
180 × 0.0001
4 (𝜋)5 × (1601.2)
√ =𝑛
180 × 0.0001
n = 72.23 ≈ 72
b
∆x
∫ f(x)dx = [f(x0 ) + 4f(x1 ) + 2f(x2 ) + 4f(x3 ) + 2f(x4) … + 2f(xn−2 ) + 4f(xn−1 ) + f(xn )]
a 3
𝝅
∫ 𝒄𝒐𝒔(𝒙𝟐 ) = 𝟎. 𝟓𝟔𝟓𝟔𝟗𝟐
𝟎
Numerically,
𝜋
∫ cos(𝑥 2 ) = 0.565692
0
Analytically,
𝜋
∫ cos(𝑥 2 ) = 0.565694
0