LAGRANGE COLLEGE HOME PAGE
COMPUTER SCIENCE

LaGrange College QUICK FACTS

DR. RIDDLE'S HOME PAGE


CSCI 4100:

4100 HOME PAGE

E-MAIL: friddle at lagrange.edu

CSCI 4100 SPRING 2005
ASSIGNMENT 1 DUE FEBRUARY 17

Write a program using the algorithm in Chapter 1 to approximate the derivative of f(x) = x3 +5 at x= 2 using the definition of the derivative

f ' (x) =            lim               f(x+h) – f(x)
            h → 0              h

Initialize the error to some small amount, say .00005. Initialize h to .1. Compute (f(x+h)=f(x))/h to approximate the derivative. Then use a do/while loop that first multiplies h by .1, and then recomputes (f(x+h)=f(x))/h. Do this as long as two successive approximations differ by more than the error you chose. After the loop, output the value of the approximation.

________________