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 as
increases from 0 to
in steps of
. Since you have the initial value
, 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
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 in a file called
report. What happens if you change
to
? What
happens to the relative error?
Although we don't generally have a nice analytical solution for
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