CS 323 - Spring 2006
Homework 1

Due at start of class: Monday, February 6


Check this page for updates and clarifications
(Any changes will be marked with [Update])


Instructions
Answer the following questions. When writing up your solution, include some brief narrative to explain your approach (in other words, show your work; don't just give the final answer.) Clearly state any assumptions you make.

When you use MATLAB, hand in everything: the programs, transcripts (from the command window) and graphs. Label them (by hand is ok). No need to write a general program (such as one that accepts varying input) unless explicitly specified. Comment the program and output so that it can be understood without too much trouble. Print out any graphs.


Problem 1

(a)    Derive the quadratic (n=2) Taylor polynomial for f(x)= x ex = x exp(x) around x=0, and the Taylor error term (in terms of the point c, which lies between 0 and x). In case you can't remember the product rule: (f g)' = f'g + fg'. You're welcome to use Maple to check your work, but please do this little calc problem yourself as a refresher. Suggestion: simplify the expression you get after you take each derivative.

(b)    In MATLAB, graph f(x) alongside the quadratic Taylor approximation you derived in (a), for the domain [0,1].

(c)    What are the lower and upper bounds on the absolute error that come from the Taylor error term, when using this approximation to compute f(x) when x is in [0,1]?

(d)    The difference between these two plots in (b) is the absolute error. In MATLAB, graph this difference along with the upper and lower bounds on the Taylor error that you derived in (a).


Problem 2

The general (degree n) taylor series and taylor error term for f(x)=sin(x) around x=0 is given in § 1.2 of the text in equation (1.14).

Suppose you need to compute sin(Pi/2)=1 to a level of accuracy sufficient for an IEEE normalized single precision floating-point number (see § 2.1 of the text).

(a)    What is the largest acceptable absolute error for this situation?

(b)    Write a short Matlab program that uses the Taylor error upper bound to determine the smallest "safe" value of n for this task (i.e. using a loop). What is n?

(c)    Write a short Matlab program that determines the actual minimal value of n required for this task, by monitoring the absolute error as n increases. (So you don't use the Taylor error bound here.) What is n?


Problem 3

Answer the following questions about the IEEE normalized double precision floating point standard (in both binary and decimal):

(a)    What is the largest floating point number?

(b)    What is the smallest non-zero positive floating point number?

(c)    What is the smallest separation between adjacent floating point numbers?

(d)    What is the largest separation between adjacent floating point numbers?


323 Home