> For x really close to 1 you will get overflow or division > by zero independently of way you comupute your function.
In my case, P_lm(x) is proportional to (1-x^2)^(m/2) by definition, thus dividing it by that same factor should give me a perfectly ok number.
Il giorno lunedì 24 giugno 2013 01:05:59 UTC+2, Waldek Hebisch ha scritto: > Guido Walter Pettinari wrote: > > > I would like to add that, since I need to evaluate this function very close to theta=n*pi, I cannot just use the result from a Legendre polynomial routine and divide it by sin(theta)^m. > > > > > > > Why not? If I understood your notation P_lm(x) will be close to 1 > > and the other term close to 0. As long as both terms have high > > relative accuracy division will produce accurate result. > > For x really close to 1 you will get overflow or division > > by zero independently of way you comupute your function. > > > > -- > > Waldek Hebisch >