Docsity

Sample Midterm Exam Questions - Computational Methods | CMSC 460, Exams of Computer Science

Toggle sidebar
bg1
AMSC/CMSC 460 SUMMER 2009
SAMPLE MIDTERM EXAM
1.
(a) In three digit (base 10) arithmetic with rounding, what is the value of machine epsilon?
Use three digit arithmetic with rounding to do the following computations. In each
case, find the absolute and relative errors in your results compared to the exact answer.
(b) (221 −0.328) −219
(c) (221 −219) −0.327
2. Let
A=1
4
3
4
1 1
(a) Find a permutation matrix P, a lower triangular matrix Land an upper triangular
matrix Usuch that A=P LU with the factorization corresponding to Gauss elimina-
tion with partial pivoting.
(b) Use the factorization to solve Ax=bwhere b= (1
2,1)T.
3. A quadratic polynomial p2(x) interpolates data points (1,0),(2, y),(3,14). Find yif the
coefficient of x2in p2(x) is 3.
4. A natural cubic spline Son [0,2] is defined by
S(x) = 2 + 2x−x3,0≤x≤1,
3 + b(x−1) + c(x−1)2+d(x−1)3,1≤x≤2.
Find b, c and d.
5. Find the best least squares fit by a linear function y=β0+β1xto the data points
(0,6),(1,4),(2,1),(3,0). Make a table showing the observed values of y, the predicted
values of yand the errors (the difference between the predicted and observed values). If
you did your work correctly, the errors should sum to zero.
6. Consider the integration rule
I=Z1
0
f(x)dx ≈A1f(1/4) + A2f(3/4) = Q1
(a) Show that if we try to determine A1and A2in such a way that the rule is exact for
all first degree polynomials, we are led to the linear system of problem 2.
(b) What result does the rule give when f(x) = ex? Compare the result with the exact
value and that obtained by using the (simple) Trapezoid rule, T1. Which rule does
better ?
(c) Is the above rule exact for quadratics ?
pf2

Partial preview of the text

Download Sample Midterm Exam Questions - Computational Methods | CMSC 460 and more Exams Computer Science in PDF only on Docsity!

AMSC/CMSC 460 SUMMER 2009

SAMPLE MIDTERM EXAM

(a) In three digit (base 10) arithmetic with rounding, what is the value of machine epsilon?

Use three digit arithmetic with rounding to do the following computations. In each case, find the absolute and relative errors in your results compared to the exact answer. (b) (221 − 0 .328) − 219 (c) (221 − 219) − 0. 327

  1. Let

A =

4

3 4 1 1

(a) Find a permutation matrix P , a lower triangular matrix L and an upper triangular matrix U such that A = P LU with the factorization corresponding to Gauss elimina- tion with partial pivoting. (b) Use the factorization to solve Ax = b where b = ( 12 , 1)T^.

  1. A quadratic polynomial p 2 (x) interpolates data points (1, 0), (2, y), (3, 14). Find y if the coefficient of x^2 in p 2 (x) is 3.
  2. A natural cubic spline S on [0, 2] is defined by

S(x) =

{ (^) 2 + 2x − x^3 , 0 ≤ x ≤ 1 , 3 + b(x − 1) + c(x − 1)^2 + d(x − 1)^3 , 1 ≤ x ≤ 2. Find b, c and d.

  1. Find the best least squares fit by a linear function y = β 0 + β 1 x to the data points (0, 6), (1, 4), (2, 1), (3, 0). Make a table showing the observed values of y, the predicted values of y and the errors (the difference between the predicted and observed values). If you did your work correctly, the errors should sum to zero.
  2. Consider the integration rule

I =

0

f (x) dx ≈ A 1 f (1/4) + A 2 f (3/4) = Q 1

(a) Show that if we try to determine A 1 and A 2 in such a way that the rule is exact for all first degree polynomials, we are led to the linear system of problem 2. (b) What result does the rule give when f (x) = ex^? Compare the result with the exact value and that obtained by using the (simple) Trapezoid rule, T 1. Which rule does better? (c) Is the above rule exact for quadratics?

(d) By scaling or otherwise find the corresponding rule for an integral over an interval of length h.

I =

∫ (^) h

0

f (x) dx ≈ α 1 f (h/4) + α 2 f (3h/4) = Qh

(e) Given that the error of the rule is of the form

e = I − Qh = cf ′′(ζ)h^3

for smooth f , where 0 < ζ < h, find the constant c.