Unfortunately, the current implementation of spherical harmonics in Sage suffers from various issues. One is the sign convention, which is different from the standard one, as you pointed out. Another issue is getting false results for some parameters, like
sage: theta, phi = var('theta phi')
sage: spherical_harmonic(1, 1, theta, phi)
-1/4*sqrt(3)*sqrt(2)*sqrt(-sin(theta)^2)*e^(I*phi)/sqrt(pi)
The term sqrt(-sin(theta)^2) in the above expression is plain false. It should be sin(theta).
This issue is related to the bug reported in
As a workaround, I would recommend to use the function spin_weighted_spherical_harmonic with the spin weight set to zero instead of spherical_harmonic. The function spin_weighted_spherical_harmonic is not part of the main SageMath, but of the SageMath package
kerrgeodesics_gw. So you have to install the later via
sage -pip install kerrgeodesic_gw
NB: on CoCalc, you have to add the option --user:
sage -pip install --user kerrgeodesic_gw
Then, you will get (the first argument, i.e. 0, is the spin weight; if zero, one gets the standard spherical harmonics):
sage: from kerrgeodesic_gw import spin_weighted_spherical_harmonic
sage: spin_weighted_spherical_harmonic(0, 2, 1, theta, phi)
-1/4*sqrt(15)*sqrt(2)*cos(theta)*e^(I*phi)*sin(theta)/sqrt(pi)
sage: spin_weighted_spherical_harmonic(0, 1, 1, theta, phi)
-1/4*sqrt(6)*e^(I*phi)*sin(theta)/sqrt(pi)
Both results agree with the standard values, as given e.g. in
Eric.