Sie sind auf Seite 1von 5

CSCI E-201 Numerical Analysis Final Exam Solutions

Name:

Dec 18th, 2012

1) (10 points) QR Decomposition


! !
1 25 5 12
    
1 2 0.447 0.894 2.24 5.37
5 5 5
= 2 1 1

2 5 5 5
0 5
0.894 0.447 0 0.447

2) (15 points) Householder Reflectors


Given the matrix

1 1
1 2
A=
1

3
1 4
(a) Projection Construct the projection P1 based on the first column

v = (2, 0, 0, 0) (1, 1, 1, 1) = (1, 1, 1, 1)



1 1 1 1
vv T 1 1 1 1 1
P = T =
v v 4 1 1 1 1
1 1 1 1
(b) Reflection Use the projection P1 to construct the reflection, H1


1 0 0 0 1 1 1 1 1 1 1 1
1 1 = 1 1 1 1
0 1 0 0 1 1 1 1
H = I 2P =
0 0 1 0 2 1 1 1 1 2 1 1 1 1
0 0 0 1 1 1 1 1 1 1 1 1

(c) Compute the product H1 A



1 1 1 1 1 1 2 5
1 1
1 1 1 1 2
0 2
=
2 1 1 1 1 1 3 0 1
1 1 1 1 1 4 0 0

1
CSCI E-201 Numerical Analysis Final Exam SolutionsName:

3) (10 points) Runge-Kutta


Write down Pseudo Code that could be used to take h, f (t, y) and (ti , wi ), and compute
(ti+1 , wi+1 ) using the method described by the Butcher tableau below.

0
1 1
1 0 1
1 1
2
0 2
k1 = hf (ti , yi )
k2 = hf (ti + h, yi + k1 )
k3 = hf (ti + h, yi + k2 )

1
wi+1 = wi + (k1 + k3 )
2

4) (20 points) Gram-Schmidt and Orthogonal Polynomials


Use the Gram-Schmidt process to transform the polynomials {u0 , u1 , u2 } = {1, x, x2 } into
an orthogonal basis on the interval [0, 1].
This solution goes beyond what I expected you to turn in.
We start by finding the norm of the constant u0 (x) = 1.
Z 1 Z 1 1

(u0 u0 )dx = dx = x = 1
0 0 0

so the first element is p0 (x) = 1. Now compute the dot product < p0 , u1 >
Z 1 Z 1 1
x2 1
< p0 , u1 >= u1 (x) p0 (x)dx = xdx = =
0 0 2 0 2
We plug that in our Gram-Schmidt computation:
1 1
v1 = x < p0 , x > p0 = x 1=x
2 2
Next, we normalize v1 (x) to find p1 (x).

1 1
(x 21 )3 1
Z Z
1 2 1 1 1
< v1 , v1 >= v1 (x) v1 (x)dx = (x ) dx = = + =
0 0 2 3
0 24 24 12


 
1
p1 (x) = 2 3 x
2
Now that we have a normal basis, we can compute v2 (x) as

2 of 5
CSCI E-201 Numerical Analysis Final Exam SolutionsName:

v2 = u2 < p1 , u2 > p1 < p0 , u2 > p0 = x2 < p1 , x2 > p1 < p0 , x2 > p0

2 1 1
Z
1 2
Z 1
v2 = x 2 3(x ) 2 3(x )x dx x2 dx
2 0 2 0

1 1 ! 1 !
x4 x3 x3
   
2 1 2 12 1 1 1
v2 = x 12 x =x x = x2 x +
2 4 0 6 0 3 0 12 2 3 6

5) (20 points) Marxist Numeric Integration


Our approximation is Marxist, as it samples the left, but not the right, edge.
Z b
f (x)dx (b a)A0 f (x0 ) + A1 f (x1 ) = A0 f (1) + A1 f (0)
a
(a) Interpolation Sketch (draw freehand) the two interpolating polynomials.

If this is to work everywhere, it must work on an interval of your choice. I am using the
interval [1, 1]. This means that
Z b Z 1
f (x)dx = f (x)dx (b a)(A0 f (x0 ) + A1 f (x1 )) = 2(A0 f (1) + A1 f (0))
a 1
I am evaluating at x0 = 1 and x1 = 0. My interpolating polynomials will be 1st degree,
and will go through the points (1, 1), (0, 0) for A0 and (1, 0), (0, 1) for A1 . In general,
these polynomials will have zeros at n 1 of the abscissae, and 1 and the remaining abscissa.
The equation for the polynomial for A0 is
x x1 x0 x
y= = = = x
x0 x1 1 0 1
The equation for the polynomial for A1 is
x x0 x+1
y= = =x+1
x1 x0 0 (1)
We draw these below: clearly they work, and you can easily compute the area.

y = x y =x+1

3 of 5
CSCI E-201 Numerical Analysis Final Exam SolutionsName:

(b) Weights Compute the weights A0 and A1 , visible as the areas above. Note (b a) =
(1 (1)) = 2.
1
1 1 x2
Z
A0 = xdx = = 0
2 1 2 1
1
1 1 (1 + x)2
Z
4
A1 = (1 + x)dx = = 0=1
2 1 4
1 4
(d) Name Clearly the left sample is not used. This is simply the midpoint method

(c) Degree of Precision We will try this method on polynomials of increasing degree.
Z 1
?
dx = 2 = 2(A0 f (1) + A1 f (0)) = 0 + 2 1 = 2
1

1
1
x2
Z
?
xdx = = 0 = 2(A0 f (1) + A1 f (0)) = 0 + 2 0 = 0
1 2 1
Z 1 1
2 x3 2
x dx = = 6= 2(A0 f (1) + A1 f (0)) = 0 + 2 0
1 3 1 3
The method has degree 1. It works on linear functions, but not quadratic functions.

6) (25 points) Initial Value Problem


Given the differential equation y 0 = ty, and initial condition y(0) = 1, compute an estimate
of (t, y) (0.5, w1 ) after one step with h = 0.5 using each of the following methods.

(a) Vector Field Sketch a vector field and identify a stable solution.

4 of 5
CSCI E-201 Numerical Analysis Final Exam SolutionsName:

y=0
(b) Euler method w1 = w0 + hf (t0 , w0 ) = 1 + 0 = 1

(c) Backwards Euler method w1 = w0 + hf (t1 , w1 ) = 1 + 21 f ( 12 , w1 ) = 1 41 w1

5 4
w
4 1
= 1, so w1 = 5
= 0.8
h
(d) Trapezoid Method w1 = w0 + (f (t0 , w0 ) + f (t1 , w0 + hf (t0 , w0 )) = 1 +
2
h
2
(f (0, 1) + f ( 12 , 1)) = 1 + 14 (0 21 ) = 7
8
= 0.875

(e) Analytic Solution Find closed form solution to this problem. How does it compare
to your computations?
Z 0 Z
y
= tdt
y
t2
ln(y) = +C
2
t2
y = Ce 2
Plug in our initial condition y(0) = 1 to get
t2
y = e 2
1
Evaluate at t = 0.5 to get e 8 0.8825

5 of 5

Das könnte Ihnen auch gefallen