# Will the numerical solving of the differential equation be wrong if I take the step too small? [closed]

If I take the step too large I will get error, while if I take the step too small I also get an error. In my case, instead of seeing the function decreasing, i have it increasing if I take the step too small.

• It is very difficult to answer with such few details. Please consider improving your post by at least writing the PDE you are dealing with as well as the numerical scheme. – Coriolis Oct 14 '16 at 11:06

Using too small of a timestep can lead to accuracy issues due to finite precision. Since you can use derivative approximations to derive time integration schemes, it is fair to look at how derivative approximations fare as you change stepsize. As you can see above, where I used a second order central difference approximation, the error for derivative step sizes between $1$ and $10^{-5}$ produce the expected second order convergence rate. However, past that span of step sizes, the error starts to grow.

This is a problem with finite precision and so it's feasible that too small a step size in your integration schemes could result in a similar issue.

• It's a little curious that the approximation starts to fail around $10^{-5}$, are you using single precision? It is also worth noting that some derivative approximations are more sensitive to mesh spacing when it is sufficiently small. Spectral methods are a good example of this, where the condition number of the derivative operator grows as $10^{2p}$ where $p$ is the order of the derivative. – Spencer Bryngelson Oct 14 '16 at 23:59
• @SpencerBryngelson You are correct about different schemes being more or less sensitive than others. In terms of the approximation starting to fail kind of soon, I agree as it seemed odd when I first saw it too. I wrote a quick code in Matlab to generate the above plot, so I will paste the code later so others can try as well. – spektr Oct 15 '16 at 0:08
• At the very least your result is qualitatively correct, which I suppose is the point anyhow. – Spencer Bryngelson Oct 15 '16 at 0:10
• I agree, the point is certainly conveyed. I think it's also worth adding that the sudden increase in error will shift as the precision is increased from single to double, quadruple etc. – Charles Oct 15 '16 at 3:25
• @SpencerBryngelson $h^2+\epsilon h^{-1}$ is minimized at $h\sim \epsilon^{1/3}$, so a minimized error at $h\approx 10^{-5}$ makes sense for double-precision arithmetic with $\epsilon\approx 10^{-16}$. – Kirill Oct 15 '16 at 17:15