# Potential and E field for a non homogeneous charge Density

Diracobama2181
Homework Statement:
Suppose you have an infinite slab of thickness 2a has a volume charge density ρ(x) given by $$ρ(x) = ρ_0sin(πx/a) , |x| ≤ a$$, and
$$ρ(x) =0 ,|x| > a$$
where ρ0 and a are positive constants. The geometry of this
system is such that x = 0 is the central plane contained inside the slab with
the x−axis being perpendicular to it. In addition, take this plane to be the
potential reference plane; i.e., φ(x = 0) = 0. For the above charge distribution,
calculate the potential φ(x) and the electric field E(x) everywhere in space.
Relevant Equations:
$$\nabla^2V=-\frac{\rho}{\epsilon}$$
Based on the conditions, I found that $$V(x)=\frac{a^2}{\pi^2} ρ_0sin(πx/a)$$ would be a solution to Laplace's equation for $$|x|\leq a$$
and $$V(x)=cx+d$$, where c and d are constants. From the boundary conditions, $$\frac{dV(a)}{dx}=\frac{a}{\pi} ρ_0cos(πa/a)=ac$$, $$c=\frac{a\rho}{\pi}$$ and $$V(a)=ca+d=\frac{a^2}{\pi^2} ρ_0sin(πa/a)$$, $$V=\frac{a\rho}{\pi}x+\frac{a^2\rho}{\pi}$$ for $$x>a$$ (a similar setup would find V(x) for x<-a). Does my setup seem correct? Also, wouldn't $$V(x)=\frac{a^2}{\pi^2} ρ_0sin(πx/a)+kx+l$$ also be a solution for constants k and l? Thank you.