Problem 2

Due: February 14                           CSCI 381                             Spring 2018

You are employed by the Subdivision On Large, Vincible Exercises (SOLVE). SOLVE has just been asked to help out the Computer Operations Network For Useful Synthesis of Engineering Devices (CONFUSED), a division of ACME. CONFUSED has a new project currently in the mill: they are building the new ACME Widget For Useful Logarithms (AWFUL). You have been asked to help out the project team designing the AWFUL. Your particular task is to design the firmware for the ex key. Your boss, Biro Kratt has insisted that the correct way of doing this is to use the Taylor series for ex.

Your mission, and you have no choice about whether or not to accept it, is to write a program which reads a value from the user and evaluates the function ex there. Your program should keep adding successive terms to the intermediate result until the answer no longer changes, i.e., the sum is accurate to machine precision. Recall that

The program should output the computed value, the number input by the user, the actual value of the function there (by using your language’s built in ex function), the absolute error, the relative error, and the number of terms that had to be added. Run the program for the following values of x: 1, 5, 10, 15, 20, 25, 30, -1, -5, -10, -15, -20, and -30.

At this point, you should notice that something terrible has happened. Explain what’s gone wrong to your boss (by writing down the explanation and handing it in). The future of your job with ACME depends on your being able to convince your boss that it was his method, rather than your faulty programming, which caused the travesty. If there is a way to correct this problem without abandoning the Taylor series idea, explain what it is.

Hint 1: You should be aware that n! is likely to cause an overflow even for moderate values of n. However, we really don’t want n! by itself, we want xk/k! to use as a term. It may be useful to make use of the equation

Hint 2: To work on getting more accurate answers, look at where things work and where things don’t work. See if you can develop a mathematical relationship between things that don’t work and things that do work and utilize that relationship so you only have to use things that do work.