Name:
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
1
CSCI E-201 Numerical Analysis Final Exam SolutionsName:
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
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:
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
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.
(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
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