1

I am writing a program to find order of convergence of the Euler's method for finding numerical solution of ODE with given initial condition. The formula to estimate the order of convergence is given by $q=\frac{\log(\frac{e_{new}}{e_{old}})}{\log(\frac{h_{new}}{h_{old}})}$ where $e_{new}=|\text{actual value}-\text{numerical value with } h_{new} \text{ step size } |$, $e_{old}=|\text{actual value}-\text{numerical value at } h_{old}\text{ step size}|$ $h_{new}=\text{step size at }(i+1)^{th} \text{stage}$,$h_{old}=\text{step size at }(i)^{th} \text{stage}$. I made a Matlab program to estimate the order but for smaller step size this estimate is becoming zero or negative values and it is nowhere near 1 which is the order of convergence of Euler method. I am unable to find a mistake. Is my formula right or am I doing something wrong?

Vítězslav Štembera
  • 2,307
  • 1
  • 10
  • 19
  • This appears to be correct for computation with limited precision floating-point numbers, see https://math.stackexchange.com/questions/3609842/numerical-analysis-heuns-method or https://math.stackexchange.com/questions/1191072/how-to-calculate-the-errors-of-single-and-double-precision – Lutz Lehmann Mar 19 '22 at 10:31
  • Could you add the IVP that you tested this on? With standard toy examples one needs $10^8$ or more steps for an accordingly small step size to leave the region where the error behaves according to the method order. – Lutz Lehmann Mar 20 '22 at 09:56
  • @LutzLehmann You are right. I falsely believed that the rate of convergence definition of discretization methods coincide, if the sequence of time steps is explicitly defined like $h_k=\frac{h_0}{2^k}$, with the rate of convergence of the obtained sequence through the definition of Q-convergence, at least in terms of order. This is obviously not the case. Thanks for this discussion. – Vítězslav Štembera Mar 21 '22 at 19:16

0 Answers0