The Runge-Kutta algorithm program source code was named rk1.c and was compiled on nova.npac.syr.edu, with the following line:
gcc -O rk1.c -o rk1 -lm
The executable "rk1" 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.000000, w = 0.500000 t = 0.200000, w = 0.810700 t = 0.400000, w = 1.148146 t = 0.600000, w = 1.515002 t = 0.800000, w = 1.914519 t = 1.000000, w = 2.350671 t = 1.200000, w = 2.828310 t = 1.400000, w = 3.353362 t = 1.600000, w = 3.933065 t = 1.800000, w = 4.576262 t = 2.000000, w = 5.293750
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 stepsize decreases by 50% the global error decreases by approximately 45%.
Stefan Joe-Yen, SUNY Health Science Center at Syracuse