next up previous
Next: What to hand in Up: Approximating iteratively: CSC270, Assignment Previous: A more challenging function


Your job

In a file called diffeq.c you will implement the function delist specified in diffeq.h. Your function will use Equation1 and the steps outlined in the previous section to approximate $ f(x)$ as $ x$ increases from 0 to $ 1.0$ in steps of $ 0.01$. Since you have the initial value $ f(0) = 2$, you can fill in the zeroth entry of the table with no calculation:

    {0.0   2.0   2.0   0.0}
For the remaining 99 entries, you have to use the approach described in the last section to calculate $ f_x$.

You may define any helper methods you choose in diffeq.c. You may modify the constants TABLELINES and STEPSIZE in diffeq.h, but you shouldn't alter any of the declarations there. You are welcome to use testdiffeq.c to test drive your solution, and Makefile to build testdiffeq.

Briefly comment on your results for $ K==10$ in a file called report. What happens if you change $ K$ to $ 500$? What happens to the relative error?

Although we don't generally have a nice analytical solution for $ f(x)$ that we have derived here, you can use the one provided (Equation 3) to analyze truncation error. In the course notes, page 14-15, there is an expression for the truncation error introduced by truncating a Taylor series (Equation 1.5.4). Substitute our solution into this expression to see whether you can come up with a way to improve our approximation. Explain your suggestion in report


next up previous
Next: What to hand in Up: Approximating iteratively: CSC270, Assignment Previous: A more challenging function
Danny Heap 2002-09-22