# How to numerically solve Laplacian Equation in a system dependent boundary conditions?

I would like to solve the Laplacian equation in the following system in order to find out the potential and the Electric field everywhere. I have solved a couple of exercises by solving numerically the Laplacain Equation, but I do not know how to proceed in this one:

I would like to find out $$V_1$$ and $$V_2$$ keeping in mind the boundary condition I wrote in the picture.

Could someone give me hint how to proceed in Mathematica. I have no idea how to solve the Laplacian equation for both regions in simultaneous. Furthermore, I have a neumann boundary condition with dependent variables, which in a couple of tries I did without sucess, I have received an alert saying that "NDSolve: Derivatives of dependent variables in boundary conditions are not supported with Finite Element Method in this version of NDSolve"

Try this:

Clear[eps, epsilon];
Manipulate[
domain = ImplicitRegion[0 <= x <= 1 && 0 <= y <= 1, {x, y}];
epsilon[x_, y_] := If[y <= 1 - x, 1, eps];
eq = Inactive[Div][
epsilon[x, y]*Inactive[Grad][u[x, y], {x, y}], {x, y}] == 0;
sol = NDSolveValue[{eq, DirichletCondition[u[x, y] == 0, y == 0],
DirichletCondition[u[x, y] == 5, y == 1]},
u[x, y], {x, y} \[Element] domain];
Plot3D[sol, {x, y} \[Element] domain,
AxesLabel -> {Style["x", 16, Italic], Style["y", 16, Italic],
Style["u", 16, Italic]}, ColorFunction -> "TemperatureMap",
ImageSize -> 300], {eps, 1, 30, 10, Appearance -> "Labeled"}]


with the following effect:

Have fun!

• Thank you so much!! Your solution is very smart and subtle!! Sep 18 at 11:42