Docsity

8 Sample Problems on Computational Methods - Midterm Exam | CMSC 460, Exams of Computer Science

Toggle sidebar
bg1
AMSC/CMSC 460 SUMMER 2008
SAMPLE MIDTERM EXAM
1. Assume a decimal (base 10) floating point system having machine precision ǫmach =
5×10−6and an exponent range of ±20. What is the result of each of the following
floating-point operations
(a) 1 + 10−7(b) 1 + 103(c) 1 + 107
(d) 1010 + 103(e) 1010/10−15 (f ) 10−10 ×10−15
2.
(a) Traditional Numerical Analysis doctrine says that one rarely, if ever, computes the
inverse of a matrix. Why is this?
(b) Suppose A, B and Care n×nmatrices with Band Cnonsingular, and b∈Rn.
Write a MATLAB script which evaluates
x=B−1(2A+I)(C−1+A)b
without computing any matrix inverses. (In MATLAB I=eye(n).)
3. Let
A=1 4
2 3
(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= (10,5)T.
4. Given the three data points (−1,3),(0,5),(1,9), find the interpolating quadratic:
(a) in the form ax2+bx +cby solving a system of linear equations.
(b) in the Lagrange form
(c) in a Newton form.
Show that the three representations give the same polynomial.
5. Find the linear function which best fits the data points of problem 4 in the sense of
least squares.
6. A natural cubic spline Sis defined by
S(x) = 1 + B(x−1) −D(x−1)3for 1 ≤x≤2,
1 + b(x−2) −3
4(x−2)2+d(x−2)3for 2 ≤x≤3.
If Sinterpolates the data (1,1),(2,1) and (3,0), find B, D, b, and d.
7. The (simple) Trapeziodal rule applied to Ra
0f(x), dx gives the value 5 and the Midpoint
rule gives the value 4. What value does Simpson’s rule give?
pf2

Partial preview of the text

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

AMSC/CMSC 460 SUMMER 2008

SAMPLE MIDTERM EXAM

  1. Assume a decimal (base 10) floating point system having machine precision ǫmach = 5 × 10 −^6 and an exponent range of ±20. What is the result of each of the following floating-point operations (a) 1 + 10−^7 (b) 1 + 10^3 (c) 1 + 10^7 (d) 10^10 + 10^3 (e) 10^10 / 10 −^15 (f) 10−^10 × 10 −^15

(a) Traditional Numerical Analysis doctrine says that one rarely, if ever, computes the inverse of a matrix. Why is this? (b) Suppose A, B and C are n × n matrices with B and C nonsingular, and b ∈ Rn. Write a MATLAB script which evaluates

x = B−^1 (2A + I)(C−^1 + A)b

without computing any matrix inverses. (In MATLAB I =eye(n).)

  1. Let

A =

(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 = (10, 5)T^.

  1. Given the three data points (− 1 , 3), (0, 5), (1, 9), find the interpolating quadratic: (a) in the form ax^2 + bx + c by solving a system of linear equations. (b) in the Lagrange form (c) in a Newton form. Show that the three representations give the same polynomial.
  2. Find the linear function which best fits the data points of problem 4 in the sense of least squares.
  3. A natural cubic spline S is defined by

S(x) =

1 + B(x − 1) − D(x − 1)^3 for 1 ≤ x ≤ 2 , 1 + b(x − 2) − 34 (x − 2)^2 + d(x − 2)^3 for 2 ≤ x ≤ 3.

If S interpolates the data (1, 1), (2, 1) and (3, 0), find B, D, b, and d.

  1. The (simple) Trapeziodal rule applied to

∫ (^) a 0 f^ (x), dx^ gives the value 5 and the Midpoint rule gives the value 4. What value does Simpson’s rule give?

  1. Consider the integration rule

I =

∫ (^3) h

0

f (x) dx ≈ Qh =

hf (h) +

hf (3h).

(a) Find its degree of precision, that is find the largest integer k such that the formula is exact for all polynomials of degree ≤ k. (b) Given that the error of the rule is of the form

e = I − Qh = cf (n)(ζ)hn

for smooth f , where 0 < ζ < 3 h, find the values of n and c.