You are on page 1of 2

MAE 384. Advanced Mathematical Methods for Engineers.

Homework Assignment 1. Due May 21.


1. Write the following numbers in 32-bit single-precision standard form (as stored in a computer).
(a) 66.25
(b) .06298828125
(c) -30952
2. Convert the following to decimal format:
(a) 1100101
(b) 10001101.001
(c) 10110001110001.01010111
3. Consider the function
f (x) =

cos x
sin x

Notice that, for small x, the numerator consists of a subtraction of two numbers close to each
other in size (both near 1), and the denominator is also a small number.
(a) Find the solution for x = 0:001 to six digits, including zeros. Be sure to round your
result to 6 digits at each calculation step.
(b) Use MATLAB (format long) to calculate f (0:001). Consider this to be the true value.
Find the true relative error between cases (a) and (b).
(c) Multiply f (x) by

1+cos x
1+cos x

and be sure to simplify your expression. (Recall that sin2 x +

cos2 x = 1.) Then nd the value of the new f (x) for x = 0:001 to 6 digits. (Round at
each step in the calculation.) Find the true relative error, and compare with your results
in (b). Explain your result.
4. Write a MATLAB program to nd cos x to a prescribed error input by the user. Use the series
solution, given by

1
X
( 1)n (2n)
cos x =
x
(2n)!
n=0

(Recall that 0! = 1.) Find cos( 3 ) to within a relative error of 0.0001. Use an estimated
relative approximation error given by
"a =

Sn

Sn
Sn

Note that Sn is the value of the summation for n terms in the series.
You should present your solution to this problem formally:

(a) Statement of the problem (1 sentence)


(b) How you solved the problem (a few sentences and, possibly, a ow chart)
(c) Results (value of cos( 3 ), error, number of terms required)
(d) Discussion (anything you may want to add)
(e) MATLAB code

You might also like