How do I calculate the expectation of the rational function, in the sense of the Haar measure?

I want to know the analytical solution of $$\mathbb{E}_{\psi}\frac{\langle \psi |A|\psi\rangle}{\langle \psi |A^2|\psi\rangle}$$. I see similar questions before approximate average, but it does not provide a very specific calculation method. So I want to know if there is any method to calculate this expectation, and it would be best if some simple examples being given, such as when A is a density operator. If not, is there anything similar in classical probability theory? Please advise.

Let $$A$$ and $$B$$ be two commuting diagonalizable matrices. Since they commute, they are jointly diagonalizable, which means that they share their eigenvectors. Let us denote $$\lambda_i$$ the eigenvalues of $$A$$, $$\mu_i$$ those of $$B$$ and $$\left|\varphi_i\right\rangle$$ the associated eigenvectors.
Note that the expectation we want to compute is the same if we consider Haar-random $$|\psi\rangle$$ that aren't unit vectors. It means that we can write: $$|\psi\rangle=\sum_j\left(X_j+\mathrm{i}Y_j\right)\left|\varphi_j\right\rangle$$ with the $$X_j$$ and $$Y_j$$ being independently sampled from a $$\mathcal{N}(0, 1)$$ distribution. We then have: \begin{align*} \mathbb{E}\left[\frac{\langle\psi|A|\psi\rangle}{\langle\psi|B|\psi\rangle}\right] &= \mathbb{E}\left[\frac{\sum\limits_j\lambda_j\left(X_j^2+Y_j^2\right)}{\sum\limits_k\mu_k\left(X_k^2+Y_k^2\right)}\right]\\ &= \sum_j\lambda_j\mathbb{E}\left[\frac{X_j^2+Y_j^2}{\sum\limits_{k}\mu_k\left(X_k^2+Y_k^2\right)}\right]. \end{align*} Let us denote $$E_j$$ the inner expectation. First of all, note that we have $$E_j=E_k$$ for all $$j$$ and $$k$$. Let us denote $$E$$ this value, that is $$E_j=E$$ for all $$j$$. Furthermore, we have: $$\sum_j\mu_jE_j=\mathbb{E}\left[\frac{\sum\limits_{j}\mu_j\left(X_j^2+Y_j^2\right)}{\sum\limits_{k}\mu_k\left(X_k^2+Y_k^2\right)}\right]=1.$$ Thus: $$E\sum_j\mu_j=1$$ which gives us $$E=\frac{1}{\mathrm{tr}(B)}$$. Thus: $$\mathbb{E}\left[\frac{\langle\psi|A|\psi\rangle}{\langle\psi|B|\psi\rangle}\right]=\sum_j\lambda_j\frac{1}{\mathrm{tr}(B)}=\frac{\mathrm{tr}(A)}{\mathrm{tr}(B)}.$$ In particular, the expectation you're looking for is equal to $$\frac{\mathrm{tr}(A)}{\mathrm{tr}\left(A^2\right)}$$ if $$A$$ is diagonalizable. Note that this includes density operators.