MA/CS 371 Exam I, February 20, 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. [10 Pts] Convert the base 10 floating-point number` 123.875 ` to base 2 (i.e. to binary form).

2. [10 Pts] Suppose you have a decimal machine with 4 decimal digits allocated to the mantissa. Also, assume that such a computer correctly rounds to the nearest machine-representable number. What positive real numbers x have the property fl(1.0+x) = 1.0?

3. [10 Pts] Show how log x - log (1/x) can be computed without a serious loss of significant figures. Note: the logarithm base does not matter.

4. [20 Pts] Suppose you apply Newton's method to solve the nonlinear equation
```                3
x  + 3x = 6x - 1 .
```
(a) Compute the first two Newton iterates which approximate a solution to the nonlinear equation using the initial guess
```               x  = 0 .
0
```
(b) Would Newton's method converge to a solution of the nonlinear equation if the initial guess is
```               x  = 1 ?
0
```
Explain why or why not.

```

```

Turn page over ...

5. [15 Pts] Using Lagrange interpolation, determine the polynomial of least degree that assumes the following table of values.
x y
0 0
1/2 1
-1 -1

6. [15 Pts] How accurately can one compute cos x by quadratic interpolation on the closed interval [0,1] using a table of known values (equally) separated by h= 0.001?

7. [10 Pts] Compute an approximation to the definite integral
```               2
/    dx
|    ---
|      2
/     x
1
```
using lower sums with stepsize h=1/2.

8. [10 Pts] Complete the following Matlab function trap.m which could be used to approximate the definite integral of an arbitrary function f(x) on the closed interval [a,b] using the Trapezoid Rule with constant stepsize h. You may assume the existence of a Matlab function func.m defined by the declaration

`function [f] = func(x), `

which can be used to evaluate the function f(x) at any real number x.

```   [I] = trap(a,b,n)

% Inputs:
%         a is the left endpoint of the interval
%         b is the right endpoint of the interval
%         n is the no. of subintervals in the mesh
% Output:
%         I is the approximation to the definite
%         integral

h= (b-a)/n;

```