Spherical harmonics Y (l,m,theta,phi) for general l, m

I am trying to solve integrals involving spherical harmonics Y(l,m, theta, phi) and their derivatives. I do not have any particular l,m, theta, phi values. I need to solve it for general l,m. When I am putting particular l,m values(forex l=3,m=1), Mathematica evaluates it and gives the answer. However, if I keep l,m as it is, Mathematica is not giving output. I am new to programming and coding. The code I have written is

Y[l_, m_, θ_, ϕ_] :=
SphericalHarmonicY[l, m, θ, ϕ]

Ybar[l_, m_, θ_, ϕ_] :=
SphericalHarmonicY[l, m, θ, ϕ] /. I -> -I

Integrate[
D[Y[3, 1, θ, ϕ], θ] D[
Ybar[4, 1, θ, ϕ], θ] Sin[θ] Cos[θ],
{θ, 0, π}, {ϕ, 0, 2 π}]


Mathematica is evaluating this as I have put particular l,m values above.

However, If I write

Integrate[
D[Y[l, m, θ, ϕ], θ] D[
Ybar[L, m, θ, ϕ], θ] Sin[θ] Cos[θ],
{θ, 0, π}, {ϕ, 0, 2 π}]


Mathematica is not giving any output for this. Can anyone help me with this? I need to solve the above integral keeping l,m as it is, without any particular values of l,m. Can anyone suggest any code?

• @bbgodfrey The complex-conjugate should be Ybar[l_, m_, θ_, φ_] := SphericalHarmonicY[l, m, θ, -φ]: complex-conjugation of the $e^{i\phi}$ dependency is most easily done by replacing $\phi$ with $-\phi$. Jul 1 '21 at 6:59
• I'd further recommend you don't use l as a variable name, as it is far too easily confused with the number 1. Jul 1 '21 at 6:59