The Adams Fourth Order Predictor-Corrector algorithm program source code was named apc.c and was compiled on nova.npac.syr.edu, with the following line:
gcc -O apc.c -o apc -lm
The executable "apc" was then used to solve the homework problem set for the initial value problem given.
y' = y - (t^2) +1 0 <= t < = 2 y(0) = 0.5Solutions should be generated for the time points t = 0.0, 0.2, 0.4, ... 2.0
please enter a, b, and alpha>0 2 0.5 t[0] = 0.000000, w[0] = 0.500000 t[1] = 0.200000, w[1] = 0.810700 t[2] = 0.400000, w[2] = 1.148146 t[3] = 0.600000, w[3] = 1.515002 t[4] = 0.800000, w[4] = 1.962027 t[5] = 1.000000, w[5] = 2.439980 t[6] = 1.200000, w[6] = 2.934416 t[7] = 1.400000, w[7] = 3.432477 t[8] = 1.600000, w[8] = 3.917161 t[9] = 1.800000, w[9] = 4.367745 t[10] = 2.000000, w[10] = 4.758974
SOLUTION:
To examine the convergence of the algorithm. The initial value above was
solved using the 0.001, 0.005, 0.010, 0.020, and 0.040 time steps. The
finest resolution time series (0.001) was used as a standard and the values
of the coarser time step series were compared relative to the 0.001 series.
The cumulative and average errors of the time series relative to the standard were calculated by an error calculation program and the results are shown here. As the step size becomes smaller and the resolution increases both the cumulative and the average global error decreases. As the step size is reduced by 50% the global error is reduced by approximately 25%.
Stefan Joe-Yen, SUNY Health Science Center at Syracuse