Expected value of function of operator I have some eigenstate $|\psi\rangle$, a smooth function $f$ and an observable $\hat{A}$. I want to compute the expected value of $f(\hat{A})$:
$$
\langle \psi|f(\hat{A})|\psi\rangle.
$$
I would do that by expanding $f(\hat{A})$ in a Taylor series. However my situation is quite simple and there might be a somewhat easier way of doing it. I have eigenstates of the form $|\ell, m\rangle$ such that $\langle \theta,\phi|\ell,m\rangle=Y_\ell^m(\theta,\phi)$. The observable in my case is $\hat{A} = \hat{y}/\hat{r} = \sin(\hat{\theta})\sin(\hat{\phi})$. I'm having trouble here. For instance, if $\hat{A}=\hat{\theta}$ then I would do:
$$
\langle \psi|\hat{\theta}|\psi\rangle = \langle \psi|\int_0^\pi \theta|\theta\rangle\langle\theta||\psi\rangle.
$$
 A: If the state $|\psi \rangle = |\ell, m\rangle$, where $\langle \theta,\phi | \ell, m\rangle = Y^m_\ell(\theta,\phi)$ are the normalised spherical harmonics, then the expectation value of an operator $\mathcal O$ is given by,
$$\langle \mathcal O \rangle = \int d\Omega \, Y^{-m}_\ell (\theta,\phi) \, \mathcal{O} \, Y^m_\ell(\theta,\phi)$$
over the unit sphere, $d\Omega = \sin \theta \, d\theta d\phi$. In your case, applying the definition of the harmonics,
$$= \frac{(2\ell+1)}{4\pi}\int \, d\Omega \, P^{-m}_\ell(\cos \theta) \, (\sin \theta \sin \phi) \, P^m_\ell(\cos \theta) = 0$$
since luckily, the easier integration over $\phi$ is simply,
$$\int_0^{2\pi} d\phi \, \sin \phi = 0,$$
and there is no need to do the daunting integration over $\theta$. (Though, if you did need to do the integration over $\theta$, since Mathematica was unable to produce a closed-form answer, off the top of my head I would either replace the Legendre polynomials by a series representation, or maybe write them in terms of hypergeometric functions and make use of some of their identities.)
