Hi, Le mercredi 5 janvier 2022 à 00:36:11 UTC+1, Jonathan Thornburg a écrit :
> Sage has long had problems with spherical harmonics, e.g., this thread > from June 2019: > https://groups.google.com/g/sage-support/c/I_d_meMxRbM/m/Esxo5UO2BAAJ > > As of 9.5.beta8, spherical harmonics are (still) broken for some > arguments, > with the test case noted in that earlier thread still giving the same > (wrong) result: > 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 correct result would be > -1/4*sqrt(6)*e^(I*phi)*sin(theta)/sqrt(pi) > (see, e.g., https://en.wikipedia.org/wiki/Table_of_spherical_harmonics). > > Actually, the difference between the two results is essentially due to a different convention in the Condon-Shortley phase (cf. https://en.wikipedia.org/wiki/Spherical_harmonics#Condon%E2%80%93Shortley_phase), which makes Sage's spherical harmonics Y_l^m differ from Wikipedia and Mathematica ones by a factor (-1)^m. The other difference in the above example is a lack of simplification of sqrt(sin(theta)^2). I would vote for including the Condon-Shortley phase in Sage's spherical harmonics, since this is standard in quantum mechanics and this would make Sage agree with Wikipedia and Mathematica. Eric. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/b7f40005-d3f0-4289-a51d-7b7c216c85fen%40googlegroups.com.