0
$\begingroup$

This question is a follow up of another one I have asked a while ago. I have successfully implemented my problem using odeint library and I get the results I expect.

However I would like to give an estimation of the error for the results, obtained by Runge-Kutta method of 4th order. In addition to results obtained by the RK4 method I also have an analytical method to provide solutions.

I have seen another similar question before asking this one. But the treaty of errors in that question is rather rigorous and I don't have expertise in numerical methods. So for me a simple expression based on theory would work fine, and estimation doesn't have to be a very good one.

$\endgroup$
5
  • $\begingroup$ The theoretical error estimates tend to be worst-case bounds. Pathological examples can be constructed that attain these worst-case bounds; however, other examples can also be constructed where the error bounds overestimate the error by forty orders of magnitude. Even for formulas that are simple, obtaining or estimating the quantities required for these formulas aren't simple, and the answer that I gave in the question you linked to still applies. $\endgroup$ Dec 3, 2014 at 22:24
  • $\begingroup$ @GeoffOxberry - Thank you for your comment. I was thinking about another thing.. For the problem that I am solving with RK4 I also have an analytical method that provides solution (which is close to one obtained by RK4 of course). Is it valid to take the absolute difference of the results obtained by analytical method and RK4 and call it the error of RK4 method for this particular case ? Thank you. $\endgroup$
    – James C
    Dec 3, 2014 at 23:43
  • $\begingroup$ Assuming that the analytical method calculates the exact solution of the problem you are trying to solve numerically, then yes, taking the difference of the two solutions calculates the error in your RK4 solution. However, if your analytical solution calculates an approximate solution, then the difference of that and the RK4 solution will yield an approximate error, and the quality of this approximation depends on the accuracy of the approximate solution calculated by your analytical method. $\endgroup$ Dec 4, 2014 at 0:17
  • $\begingroup$ @GeoffOxberry - Excellent, thank you very much. If you want you can combine your two comments into an answer. $\endgroup$
    – James C
    Dec 4, 2014 at 0:22
  • $\begingroup$ Done. (The rest of this message is filler to satisfy a 15 character minimum.) $\endgroup$ Dec 4, 2014 at 0:48

1 Answer 1

0
$\begingroup$

The theoretical error estimates tend to be worst-case bounds. Pathological examples can be constructed that attain these worst-case bounds; however, other examples can also be constructed where the error bounds overestimate the error by forty orders of magnitude. Even for formulas that are simple, obtaining or estimating the quantities required for these formulas aren't simple, and the answer that I gave in the question you linked to still applies.

You mention being able to calculate a solution via an analytical method. Assuming that the analytical method calculates the exact solution of the problem you are trying to solve numerically, then yes, taking the difference of the two solutions calculates the error in your RK4 solution. However, if your analytical solution calculates an approximate solution, then the difference of that and the RK4 solution will yield an approximate error, and the quality of this approximation depends on the accuracy of the approximate solution calculated by your analytical method.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.