Docsity

Midterm Exam with Solutions - Applied Numerical Methods | MATH 151A, Exams of Mathematics

Toggle sidebar
bg1
UCLA MATH 151A/2, WINTER 2007, MIDTERM EXAM
NAME STUDENT ID #
This is a closed-book and closed-note examination. No calculators are allowed. Please
show all your work. Partial credit will be given to partial answers. There are 5
problems of total 100 points.
You do not have to completely carry out the algebraic calculations.
PROBLEM 1 2 3 4 5 TOTAL
SCORE
I. Let f(x) = 3x−ex, and the table
x1 1.125 1.250 1.375 1.500 1.625 1.750 1.875 2
f(x) 0.2817 0.2948 0.2597 0.1699 0.0183 -0.2034 -0.5046 -0.8958 -1.3891
(a) Prove that the equation f(x) = 0 has at least a solution pin the interval [1,2].
Solution: From the table, we see that f(1) = 0.2817 >0, while f(2) = −1.3891. Also, fis
continuous on [1,2], thus by the Intermediate Value Thm., there must be a p∈(1,2) such that
f(p) = 0.
(b) By the Bisection method, find pn,n≤2 on [1,2], and write your answers in the next table.
n anbnpnf(pn)
0 1 2 1.5 0.0183
1 1.5 2 1.75 -0.5046
2 1.5 1.75 1.625 -0.2034
Solution:
(c) How many iterations are necessary to solve 3x−ex= 0 with accuracy 10−4on [1,2] ?
Solution: From the theorem from the course, we impose
|pn−p| ≤ b−a
2n≤10−4,
thus we impose 2−1
2n≤10−4, or 104≤2n.
This will give log10 104≤log10 2n, or 4 ≤nlog10 2. Finally, nmust be the smallest integer larger
or equal to 4
log10 2.
II.
(a) Use the Theorem from the course to prove that g(x) = 2−xhas a unique fixed point on [1
3,1].
1
pf3

Partial preview of the text

Download Midterm Exam with Solutions - Applied Numerical Methods | MATH 151A and more Exams Mathematics in PDF only on Docsity!

UCLA MATH 151A/2, WINTER 2007, MIDTERM EXAM

NAME STUDENT ID

This is a closed-book and closed-note examination. No calculators are allowed. Please show all your work. Partial credit will be given to partial answers. There are 5 problems of total 100 points. You do not have to completely carry out the algebraic calculations.

PROBLEM 1 2 3 4 5 TOTAL SCORE

I. Let f (x) = 3x − ex, and the table

x 1 1.125 1.250 1.375 1.500 1.625 1.750 1.875 2 f (x) 0.2817 0.2948 0.2597 0.1699 0.0183 -0.2034 -0.5046 -0.8958 -1.

(a) Prove that the equation f (x) = 0 has at least a solution p in the interval [1, 2]. Solution: From the table, we see that f (1) = 0. 2817 > 0, while f (2) = − 1 .3891. Also, f is continuous on [1, 2], thus by the Intermediate Value Thm., there must be a p ∈ (1, 2) such that f (p) = 0.

(b) By the Bisection method, find pn, n ≤ 2 on [1, 2], and write your answers in the next table.

n an bn pn f (pn) 0 1 2 1.5 0. 1 1.5 2 1.75 -0. 2 1.5 1.75 1.625 -0.

Solution: (c) How many iterations are necessary to solve 3x − ex^ = 0 with accuracy 10−^4 on [1, 2]? Solution: From the theorem from the course, we impose

|pn − p| ≤

b − a 2 n^

≤ 10 −^4 ,

thus we impose 22 −n^1 ≤ 10 −^4 , or 10^4 ≤ 2 n. This will give log 10 104 ≤ log 10 2 n, or 4 ≤ n log 10 2. Finally, n must be the smallest integer larger or equal to (^) log^410 .

II. (a) Use the Theorem from the course to prove that g(x) = 2−x^ has a unique fixed point on [^13 , 1].

Solution: Note that g is continuous and differentiable in [^13 , 1], with g′(x) = − 2 −x^ ln 2 < 0 on [^13 , 1]. Thus g is monotonically decreasing on [^13 , 1], and g(1/3) ≥ g(x) ≥ g(1), or 1 > (^211) / 3 ≥ g(x) ≥ 1 2 >^

1 3 for any^ x^ ∈^ [

1 3 ,^ 1]. We deduce that

g(x) ∈ [

, 1], for any x ∈ [

, 1].

We have |g′(x)| = 2−x^ ln 2 ≤ 2 −^1 /^3 ln 2 = (^211) / 3 ln 2 = k < 1. Therefore, by the Fixed Point Theorem, there is a point p ∈ [^13 , 1] such that g(p) = p. (b) For p 0 = 1/2, compute p 1. Solution: The fixed point iteration is pn+1 = g(pn), thus p 1 = g(p 0 ) = 2−^1 /^2 = √^12.

III. (a) Recall Newton’s method for solving f (p) = 0, with f ′(p) 6 = 0. Solution: For given p 0 , with f ′(p 0 ) 6 = 0, the Newton’s iteration is

pn+1 = pn −

f (pn) f ′(pn)

, n ≥ 0.

(b) Derive the Secant method from Newton’s method, using an approximation to the derivative. Solution: We use finite differences to approximate

f ′(pn) ≈

f (pn) − f (pn− 1 ) pn − pn− 1

Thus the Secant method is obtained by substituting f ′(pn) by this approximation in Newton’s method:

pn+1 = pn −

f (pn) f (pn)−f (pn− 1 ) pn−pn− 1

, n ≥ 1 ,

knowing p 0 and p 1. Finally, the Secant Method is: Given p 0 and p 1 , compute for n ≥ 1 the sequence

pn+1 = pn −

f (pn)(pn − pn− 1 ) f (pn) − f (pn− 1 )

IV. Let f (x) = ln(x + 1), x 0 = 0, x 1 = 0.6 and x 2 = 0.9. (a) Construct, in two different ways, an interpolation polynomial of degree at most two to approximate f , using the three points (you can use f (0.6) = 0.47 and f (0.9) = 0.6).

Solution: Using the Lagrange interpolation formula, we have

P (x) = ln(1)

(x − 0 .6)(x − 0 .9) (0 − 0 .6)(0 − 0 .9)

  • ln(1.6)

(x − 0)(x − 0 .9) (0. 6 − 0)(0. 6 − 0 .9)

  • ln(1.9)

(x − 0)(x − 0 .6) (0. 9 − 0)(0. 9 − 0 .6)

or

P (x) = 0 ·

(x − 0 .6)(x − 0 .9) (− 0 .6)(− 0 .9)

x(x − 0 .9) (0.6)(− 0 .3)

x(x − 0 .6) (0.9)(0.3)