Programming Project 1

Due January 17               CSCI 381                Spring 2018

 

This simple first project will set the tone for all projects in this course.  This course and the projects require your active participation.  There is more to these projects than just doing the program code.  Understanding through inquiry and investigation is required.  Do not be fooled by what initially may seem to be a trivial assignment.  Most assignments will either have a significant issue (learning opportunity) or require some human post processing (interpreting the results and presenting them in a reasonable manner).

 

Thacker usually has a catch phrase for every course.  For this course, the catch phrase is "Computers don't do math".  This assignment will exemplify this phrase.

 

From calculus class, you learned that

               

Of course, we cannot just use h=0 because then we would have 0/0.  To estimate the answer, we can look at various values of h and see the trend as h gets smaller (but not 0).  MATHEMATICALLY, these values should get closer to the true value of f'(x).

Let's look at a function where we know the derivative.  Let's use:

            f(x)=4x2-10x+3

So of course

            f'(x)=8x-10

and we will be interested in f'(2) which is 6.

Your task is to write a program that starts with h=0.5 and divides h by 2 for 50 iterations.  So, the last h will be 2-50.  MATHEMATICALLY, each iteration should have (f(x+h)-f(x))/h getting closer and closer to 6.  Obvious (since I am giving you this problem) there will be an issue.  You need to investigate to determine the source of this problem.  It will be best to print out ALL intermediate calculations (i.e. look at the results of all calculations to see where there may be an issue).

Turn in your program and output along with a write-up describing the problem, what causes the problem AND how to best calculate f'(x).