The main question is: How to deal with the Poisson equation in the presence of the medium interface.

Let's say we have 1D Laplace equation: \begin{equation} -\frac{d}{dx}\left(\epsilon(x)\frac{d}{dx}\right)\phi(x)=0 \end{equation} or \begin{equation} -\left(\frac{d\epsilon}{dx}\frac{d}{dx}+\epsilon\frac{d^2}{dx^2} \right)\phi(x)=0. \end{equation} Now, consider the case when \begin{equation} \epsilon(x) = \begin{cases} \epsilon_1 & \mbox{if } x<0 \\ \epsilon_2, & \mbox{if } x>0 \end{cases} \end{equation}.

If I put the equation on the equally spaced grid \begin{equation} x=n\cdot a, \ \ n=...-2,-1,0,1,2... \end{equation} ($a$ is the discretization constant) and replace the continues derivatives with the discrete counterparts, there is a problem at $x=0$ with the \begin{equation} \frac{d\epsilon}{dx}\approx \frac{\epsilon(x+a)-\epsilon(x-a)}{2a}, \end{equation} because it's clearly depend on the grid spacing. Even in the limit $a\rightarrow0 $ there seems to be a problem. What is the typical method to deal with such a problem?