analytic solution poisson equation spherical coordinates I'm trying to analitically solve a poisson equation $\nabla^{2}p(r,\theta,\phi)=f(r,\theta)$ in spherical coordinates; the boundary condition is $p(\infty,\theta,\phi)$=0.
I'm quite used to the software mathematica, however the built-in routines do not solve inhomogeneous equations.
Therefore i need other ways to get the solution; one of which might be the Green function:
$p(\boldsymbol{r})=\int_{\Omega}G(\boldsymbol{r},\boldsymbol{r'})\,f(\boldsymbol{r'}) \, d\boldsymbol{r'}$
however i don't know if the integrals involved in the above solution can be solved analytically.
Maybe the particular form of the rshd function $f(r,\theta)$ can be exploited to find a solution, specifically the function
$f(r,\theta) = \frac{A+B\,Cos(2\theta)+C \,Cos(4 \theta)}{r^{8}}+\frac{D \,Cos(\theta)+E \, Cos(3 \theta)}{r^{9}}+\frac{F+G \,Cos(2\theta)+H \,Cos(4 \theta)}{r^{10}}+\frac{I \,Cos(\theta)+L \, Cos(3 \theta)}{r^{11}}+\frac{M+N \,Cos(2\theta)+O \,Cos(4 \theta)}{r^{12}}$
Where A,B,..., O and so on are constants.
Any suggestion to solve this problem is very welcome!
Thanks in advance.
 A: A general way to proceed would be to expand the Green Function in spherical harmonics.  To that end, we have
$$G(\vec r|\vec r')=\frac{1}{4\pi|\vec r-\vec r'|}=\sum_{l=0}^{\infty}\sum_{m=-l}^{l}\frac{1}{2l+1}\left(\frac{r_<^l}{r>^{l+1}}\right)Y^*_{lm}(\theta',\phi')Y_{lm}(\theta,\phi)$$
where $r_<$ ($r_>$) is the smaller (larger) of $r$ and $r'$ and the spherical harmonic functions $Y_{lm}$ are given by
$$Y_{lm}(\theta,\phi)=\sqrt{ \frac{(2l+1)}{4\pi} \frac{(l-m)!}{(l+m)!} }P_l^m(\cos \theta)e^{im\phi}$$
Here, $P_l^m$ are the associated Legendre Polynomials which satisfy the orthogonality relationship
$$\int_{-1}^1 P_l^m(x)P_{l'}^{m'}(x)dx= \frac{2}{2l+1}\frac{(l+|m|)!}{(l-|m|)!}\delta_{ll'}$$
Note that the proposed function $f$ is independent of the azimuthal angle $\phi$, which renders the integration over $\phi$ trivial.  It will reduce the problem to an integration over $r$ and $\theta$, which involves a single series over $l$ with only the Legendre polynomials $P_l^0(\cos \theta)=P_l(\cos \theta)$.  Can you take it from here?
