Projection of a 3D spherical function to a carteasian axis I have a 3D function defined in a spherical coordinate system $(r,\theta,\phi)$, which is written as a product of a radial function $R_{nl}(r)$ and a spherical harmonic $Y_{lm}(\theta,\phi)$ I.e 
$$
 \Psi_{nlm}(r,\theta,\phi) = R_{nl}(r)Y_{lm}(\theta,\phi).
$$
Here $n,l$ and $m$ represent the quantum numbers and $\Psi_{nlm}(r,\theta,\phi)$ is a wavefunction, for some context and I only have numerical data for the radial functions. I want to plot the projection of the modulus squared of the wavefunction versus a specific carteasian axis. For example the projection in the z-axis can be defined as 
$$
f(z) = \int\int dxdy~ |\Psi_{nlm}(r,\theta,\phi)|^2.
$$
I've been told this is equivalent to writing 
$$
f(z) = \int d\vec{r}~ \delta(\vec{r}\cdot\hat{k}-z)|\Psi_{nlm}(r,\theta,\phi)|^2
$$
where $\vec{r}$ is the vector in spherical coordinates and $\hat{k}$ is the unit vector in the z direction. Is there a way to calculate this function of z (also for x and y) using one of the two equivalent forms, without knowing the analytic form of the radial function? 
 A: I'll do it for the $z$ axis to give you the idea; it's also possible for the other axes, but a bit more complicated.
The $z$ axis case is simpler both because, as noted in the comments, the integration over $\phi$ yields $2\pi$, and because in this case we have simply $\vec r\cdot\hat k=r\cos\theta$. Thus after integrating over $\phi$, we're left with
$$
f(z)=2\pi\int_0^\infty\mathrm drr^2\int_0^\pi\mathrm d\theta\sin\theta\,\delta(r\cos\theta-z)\left|R_{nl}(r)\right|^2\left|Y_{lm}(\theta,0)\right|^2\;.
$$
Since you don't have $R$ in functional form (I guess you have samples?), we want to perform the integral over the delta distribution in $\theta$, not in $r$:
\begin{eqnarray}
f(z)&=&2\pi\int_0^\infty\mathrm drr^2\int_{-1}^1\mathrm d\cos\theta\,\delta(r\cos\theta-z)\left|R_{nl}(r)\right|^2\left|Y_{lm}(\theta,0)\right|^2\\
&=&2\pi\int_0^\infty\mathrm drr^2\int_{-1}^1\mathrm d\cos\theta\frac1r\delta(\cos\theta-z/r)\left|R_{nl}(r)\right|^2\left|Y_{lm}(\theta,0)\right|^2\\
&=&2\pi\int_0^\infty\mathrm drr\left|R_{nl}(r)\right|^2\left|Y_{lm}(\arccos (z/r),0)\right|^2\;.
\end{eqnarray}
This you can evaluate numerically using your numerical representation of $R_{nl}(r)$.
The principle applied here that you'll need for the other cases is
$$
\delta(f(t)-z)=\sum_{f(t_i)=z}\frac{\delta\left(t-t_i\right)}{f'(t_i)}\;.
$$
