In order to find the potential inside a box, we use the Laplace equation if there is no charge. For example, for an infinitely long rectangular box along $z$-axis with sides at $x=0, \;x=a, \;y=0, \;y=b$, we can write that:
$$\frac{1}{X} \frac{\partial^2 X}{\partial x^2} + \frac{1}{Y} \frac{\partial^2 Y}{\partial y^2} = 0$$ when $V(x,y)=X(x)Y(y)$
We can use the boundary values(Let's say all the sides are at V=0) and solve this using separation of variable.
But my question is what happened when there is a charge density inside the box? Let's say I place a plane charge density $σ(y) = C\sin{(2πy/b)}$ at $x=a/2$ parallel to the y-z plane where $C$ is a constant.
Now I cannot use separation of variable anymore because there is a nonzero term on the right hand side of the Poisson equation. How can we solve this?
I found that we can solve this either numerically or using Green's Function method. I am asking if we can solve this problem other than these two methods.