# MA/CS 371 Exam II, April 11, 1996

### Directions: This examination is closed book and notes. You may have only one 8.5 (inches) by 11 (inches) sheet of paper containing any review material (front and back) in addition to the examination sheet and solution sheets. To receive credit, you must show all your work. If you find it necessary to make assumptions, please explicitly state them. You have 75 minutes to complete this examination. Show all your work on the solution sheets provided (you may keep the exam sheet) and make sure all the solution sheets remain stapled together before handing them in.

1. [16 Pts] Compute the following definite integrals using the 2-node Gaussian quadrature rule.
```               1                         2
/       2                 /        2
(a)     |    -3x          (b)     |     -3x
|   e     dx ,            |    e     dx .
/                         /
-1                         0
```
2. [20 Pts] Solve the following linear system of equations using naive Gaussian elimination. The use of index vectors to monitor row permutations is not necessary.
```                x  +   x  +   x   =  6
1      2      3

2x  -   x  +  2x   =  6
1      2      3

3x  +  2x  -   x   =  4
1      2      3
```

3. [12 Pts] Suppose Gaussian elimination using scaled partial pivoting has produced the following system of linear equations (in augmented matrix form):
```                _               _
|             |   |
|  1   0   1  | 7 |
|             |   |
|  0   0   3  | 9 |
|             |   |
|  0   2   1  | 5 |
|_            |  _|
```

## Turn page over ...

(a) What must be the final 3 by 1 index vector l which stores the index of each pivot row selected during the forward elimination phase?
(b) Using the final index vector l from part (a), determine the solution vector
```                               T
( x   x   x  )
1   2   3
```
using back substitution.

4. [20 Pts] Using naive Gaussian elimination, factor the following matrix A so that A = LU, where L is a unit lower triangular matrix and U is an upper triangular matrix.
```                _           _
|             |
|  3   0   3  |
|             |
A = |  0  -1   3  |
|             |
|  1   3   0  |
|_           _|
```

5. [16 Pts] Suppose S(x) is a quadratic spline over the interval `[a,b]` with `n+1` knots
```              a = t  <  t  <  t  <  ...  < t  = b.
0     1     2            n
```
(a) How many conditions are needed to define S(x) uniquely over `[a,b]`?
(b) How many conditions are defined by the interpolation conditions at the knots?
(c) How many conditions are defined by the continuity of the first derivatives?
(d) How many additional conditions are needed so that the total equals the number in part (a)?

6. [16 Pts] Carefully sketch the output of the following Matlab program. Pay particular attention to all details of the graph and estimate the placement of each point on the graph (no need to determine spline function analytically).
```               x = 0:4;
y = [3 1 0 2 4];
xx = 0:0.5:4;
yy = spline(x,y,xx);
plot(x,y,'o',xx,yy,'x');
axis([0 4 -1 4]);
xlabel('x');
ylabel('y');
title('Cubic Spline Interpolation');
```