# Numerical errors due to terms of the form $\frac{1}{r}$ (r goes to 0 at the boundary) while using finite difference method

I am trying to solve a system of differential equations using finite difference method.

There are few terms of the form $$\frac{A(r)}{r}$$, both $$A(r)$$ and r go to zero at the boundary. Analytically this term is well defined but numerically these terms are leading to error which very quickly break the simulation.

I am using leapfrog method if that matters. I read somewhere that leapfrog method has dissipation inbuilt so it should be stable, but it's clearly not the case.

Any advice on how to proceed? Should I change my algorithm? Or use higher order schemes?

• The basic advice is to consider the new variable $v(r) = A(r)/r$. One does that in the solution of the Schrödinger equation for atomic systems, for example. – davidhigh Feb 29 at 21:16
• Do you know the limit $$\lim_{r \to 0} \frac{A(r)} {r}$$, it's pretty important in this case. If the limit is a finite constant, then there is a lot of methods like in the paper linked by Spencer. If the limit is infinity, then there's a problem – Yuriy S Mar 3 at 21:01