I recently completed MIT's 8.04 quantum mechanics course on edX and have been writing python code to compute hydrogen-like electron orbitals, basically just for fun. My program computes the eigenstates based on $n$, $l$, and $m$ and uses the mayavi 3D graphics package to plot it.
My question concerns computing the $s$, $p$, $d$, and $f$ orbitals in real bases by superposition of the (complex) eigenstates. I found how to do this for $p_x$ and $p_y$ and it works as intended.
$$ p_z = p_0 \\ p_x = \frac{1}{\sqrt{2}} \left(p_1 + p_{-1} \right) \\ p_y = \frac{1}{i\sqrt{2}} \left( p_1 - p_{-1} \right) $$
So how do you do something analogous to compute $d_{z^2}$, $d_{xz}$, $d_{yz}$, $d_{xy}$, and $d_{x^2-y^2}$? From looking at some tables and observing patterns, I'm guessing that I need to do:
$$ d_{z^2} = d_0 \\ d_{xz} = \frac{1}{\sqrt{2}} \left(d_1 + d_{-1} \right) \\ d_{yz} = \frac{1}{i\sqrt{2}} \left( d_1 - d_{-1} \right)\\ d_{xy} = \frac{1}{\sqrt{2}} \left(d_2 + d_{-2} \right) \\ d_{x^2 - y^2} = \frac{1}{i\sqrt{2}} \left( d_2 - d_{-2} \right) $$
and similarly for the $f$ orbitals with $m = \pm 1, 2, 3$.
Thanks for any clarification on this. Nothing important is on the line, but I hope to understand how this works.