MA128ASampleMidterm2024 Solution
MA128ASampleMidterm2024 Solution
This is a closed book exam. You are allowed to cite any results,
up to Section 4.5 but excluding those in the exercises, from the
textbook. Results from anywhere else will be treated the same
as your answers, which need to be justified. Completely correct
answers given without justification will receive little credit. Partial
solutions will get partial credit.
1 20
2 20
3 20
4 20
5 20
Total 100
Math128A: Numerical Analysis Sample Midterm 2
1. Determine the absolute error, the relative error, and the number of
significant digits in the approximation
π ≈ 3.14
Solution:
π − 3.14 ≈ 0.00159 · · ·
|π − 3.14| 0.00159 · · ·
≈
π π
|π − 3.14|
5.0 × 10−4 < ≈ 5.07 × 10−4
π
thus the number of significant digits is 3.
Math128A: Numerical Analysis Sample Midterm 3
2. Let x0 < x1 < x2 . Find a second degree polynomial P (x) such that
The condition
P (x0 ) = f0 leads to α = f0 .
The condition
f1 − f0
P (x1 ) = f1 leads to β = .
x 1 − x0
Finally, since
P ′ (x) = β + γ(2 x − x0 − x1 )
The condition
f2′ − β
P ′ (x2 ) = f2′ leads to γ =
2 x2 − x0 − x1
Math128A: Numerical Analysis Sample Midterm 4
2x3 − 6x + 1 = 0 (1)
has a real root in the interval [0, 1/2]. Perform one step of Bisection
method with this interval.
Solution: Let
f (x) = 2x3 − 6x + 1
Since f (0) = 1 > 0 and f (1/2) = −1.75 < 0, it follows from interme-
diate value theorem that there must be a c ∈ [0, 1/2] so that f (c) = 0.
To perform one step of Bisection method with this interval, let
1 1
p= (0 + 1/2) =
2 4
Since
2 6
f (p) = 3
− + 1 < 0,
4 4
it follows that there is a root in [0, 1/4].
Math128A: Numerical Analysis Sample Midterm 5
2x3 + 1
x= .
6
Define the fixed point iteration (FPI) based on this equation, and show
that FPI convergences for any initial guess in [0, 1/2].
2x3k + 1
xk+1 =
6
for k = 0, 1, · · · , with a given x0 . Define
2x3 + 1
g(x) =
6
For FPI to converge for any initial guess in [0, 1/2], we need to prove
|g ′ (x)| = x2 ≤ κ
Math128A: Numerical Analysis Sample Midterm 6
Solution: Parameterize S as
(
a0 + b0 x + c0 x2 + d0 x3 , if x ∈ [−1, 0],
S(x) =
a1 + b1 x + c1 x2 + d1 x3 , if x ∈ [0, 1].
which leads to
a0 = a1 = f (0) = 1, b0 = b1 , c0 = c1
S(x)′′ |x=−1+ = 2 c0 − 6 d 0 = 0
S(x)′′ |x=1− = 2 c0 + 6 d 1 = 0
which implies
c0 c0
d0 = , d1 = −
3 3
Putting it all together,
(
c0
1 + b0 x + c 0 x 2 + 3
x3 , if x ∈ [−1, 0],
S(x) = c0
1 + b0 x + c 0 x 2 − 3
x3 , if x ∈ [0, 1].
leads to conditions
c0
1 − b0 + c 0 − = sin 1
3
c0
1 + b0 + c 0 − = sin 1
3
which has solution
3
b0 = 0, c0 = − (1 − sin 1)
2
and
3 x2
!
|x|
S(x) = 1 − (1 − sin 1) 1 −
2 3