You are on page 1of 4

CSCI E-24 Midterm Solutions

Jeff Parker

Oct 15 2014
This is a 120 minute, open book exam. You may use MATLAB, the course text, and
your class notes. Please do not use other resources, including other books or the Web.

1) Problem 1 (15 points)


Consider the function f (x) = 1 cos(x).

a) What difficulties do you anticipate evaluating f (x) near 0?

Solution: We are subtracting something close to 1 from 1, so we need to be aware of


catastrophic cancellations.

b) Rewrite f (x) as a Taylor series to allow a more stable computation near 0.

Solution:

x2 x4 x6 x2 x4 x6
f (x) 1 1 + + ... = + ...
2! 4! 6! 2! 4! 6!
c) Use a conjugate to rewrite f (x) to allow a more stable computation near 0.

Solution:
(1 cos x)(1 + cos x) sin2 x
f (x) = 1 cos x = =
(1 + cos x) (1 + cos x)

2) Finding Roots (25 points)



Consider the function f (x) = cos(x) x
2
a) Show that f (x) has a real root.

Solution: For x < (1 + ), f (x) is clearly positive, and for x > 1, f (x) is clearly
2
negative. The function is the sum of continuous functions, and is thus continuous, so the
Intermediate Value Theorem tells us that it must hit 0 someplace between [(1 + 2 ), 1]

b) Why might we have difficulty finding a good approximation of the root?

Solution: The root has multiplicity three, and will be poorly conditioned. We will have
catastrophic cancelation computing f(x).

1
CSCI E-24 Midterm Solutions Jeff Parker

c) Starting at x0 = 0, take two steps of Newtons method. Show x1 and x2 .

Solution: -0.5708 and -0.9157

d) How is this converging? (Hint: You may compute a few more terms to see.)

Solution: This is a multiple root. Newtons Method is converging linearly.

e) Name two ways we could speed up convergence.

Solution: We could use Modified Newtons Method, with m = 3. The first two values
would then be -1.7124 and -1.5707
Since convergence is linear, we could also use Aitkens Acceleration.

3) System of Linear Equations (5 points)


Problems 3 through 7 will be dealing with the same set of points.

We wish to fit a polynomial to the points S = {(1, 2), (2, 3), (4, 11)}
That is, we want a P (x) = a0 + a1 x + a2 x2 to run through the points in S.

a0 + a1 + a2 = 2
a0 + a1 2 + a2 4 = 3
a0 + a1 4 + a2 16 = 11

Solve this system any way you like. Describe your method and show your results.
Solution: Gaussian Elimination shows that (a0 , a1 , a2 ) = (3, 2, 1) and thus

P (x) = x2 2x + 3

4) Condition Number (10 points)


This can be rewritten as follows, using a matrix M to hold the coefficients.

1 1 1 a0 a0 2
1 2 4 a1 = M a1 = 3
1 4 16 a2 a2 11

a) What is the infinity norm of the matrix M ?

Solution: 1 + 4 + 16 = 21

2 of ??
CSCI E-24 Midterm Solutions Jeff Parker

b) What is the inverse of M ?

Solution:

16 12 2
1
M 1 = 12 15 3
6
2 3 1

c) What is the infinity norm of the inverse of M ?

Solution:

1 1
(16 + 12 + 2) = (30) = 5
6 6
d) What is the condition number for matrix M ?

Solution:
21 5 = 105

5) Error terms (10 points)


After several steps of Gauss-Siede iteration, we arrive at (a0 , a1 , a2 ) (1.25, 0.04, 0.52)

a) What is the forward error in this estimate?

Solution: The forward error is

kx xc k = k[3; 2; 1] [1.25; 0.04; 0.52]k = k0.175; 2.04; 0.48k = 2.04

b) What is the backward error in this estimate?

Solution: The backward error is

kb Axc k = k[2; 3; 11] [1.81; 3.41; 9.73]k = k[0.19, 0.41; 1.27]k = 1.27

6) Lagrange Interpolation (5 points)


Write down the expression for the polynomial given by Lagrange Interpolation for the points
{(1, 2), (2, 3), (4, 11)} You do not need to simplify the expression.
Solution:

(x 2)(x 4) (x 1)(x 4) (x 1)(x 2)


P (x) = 2 +3 + 11
(1 2)(1 4) (2 1)(2 4) (4 1)(4 2)

3 of ??
CSCI E-24 Midterm Solutions Jeff Parker

7) Newton Divided Differences (10 points)

x f (x)
1 2
2 3
4 11

a) Complete the Newton Divided Differences table above

Solution:
x f (x)
1 2
2 3 1
4 11 4 1

b) Give the interpolating polynomial defined by this table.

Solution:
P (x) = 2 + 1(x 1) + 1(x 1)(x 2) = x2 2x + 3

8) Chebyshev (6 points)
We define the Chebyshev polynomial Tn as: Tn (x) = cos(n arccos(x))

a) Compute T999 ( 12 )

b) Compute T1000 ( 12 )

Solution:
1 2
arccos( ) =
2 3

1 2
cos(999 arccos( )) = cos(999 ) = cos(666) = cos(0) = 1
2 3

1 2 2 1
cos(1000 arccos( )) = cos(1000 ) = cos(666 + )=
2 3 3 2
There is a pattern of order three at x = 21 : one third of the time, Tn ( 21 ) = 1, and two
thirds of the time Tn ( 12 ) = 21 .

4 of ??

You might also like