0

I have a system of ODEs and I solve them with two different algorithms:

  • A normal, constant stepsize, Runge Kutta 4 implementation
  • A modified Runge Kutta 4, with variable stepsize control

My professor asked me to make a plot showing convergences rate of the two algorithms to determine which one works best.

We usually do this plotting the difference between the analytical solution and the numerical one at final time vs the stepsize.

However, I don't know how to perform such analysis since for the adaptive version of the algorithm the stepsize is not fixed, hence any error vs step plot would make no sense...

Is there any other way to do it I'm not seeing?

  • For fixed step the error model is `c(t)*h^4`, for adaptive step size `c(t)*tol` if the error estimate is exact (RKF) and `c(t)*tol^a` if the error estimate is more a guidance on the local error (extrapolation methods). – Lutz Lehmann Jul 21 '22 at 17:03
  • You can also get comparable diagrams by replacing the step size with the number of function evaluations in a loglog plot against the measured error. – Lutz Lehmann Jul 21 '22 at 17:14
  • this would not work for me since I'm estimating the truncation error via stepdoubling, so I would have more function evaluations but converge in still less steps – Lorenzo Teodorani Jul 21 '22 at 17:32
  • 1
    I mean for each method do a diagram with several step sizes or error tolerances. // In the adaptive methods a decrease in the error tolerance results in a mostly proportional increase in the step density. Thus the proposed loglog plot should result in a line segment over the medium step sizes. – Lutz Lehmann Jul 21 '22 at 19:05

0 Answers0