I might have misunderstood your suggestion, but I am not sure whether a Taylor expansion of the numerator and denominator can help here. My problem is that both are very small for m>0, which generates a loss of precision in the ratio. As far as I understand, I would still have this problem after Taylor-expanding the numerator and denominator separately. On the other hand, I think that knowing the first few Taylor coefficients of the whole ratio, P_lm(x)/sin(x)^(m/2), would solve my issue.
Alas speed of execution is very important for my application, thus using high-precision libraries such as "GNU Multiple Precision Arithmetic Library" is not viable.
Il giorno sabato 22 giugno 2013 21:27:44 UTC+2, AMX ha scritto: > On Sat, 22 Jun 2013 07:00:59 -0700 (PDT), > > 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. > > > > > >> I would be grateful if somebody could point me to a numerical > > >> routine (possibly in C) to compute the following special > > >> function: > > >> P_lm (cos(theta)) / (sin(theta)^m) , > > >> > > >> where P_lm is an associated Legendre polynomial. The function > > >> can be also expresses as > > >> > > >> P_lm (x) / (1-x^2)^(m/2) . > > >> ratio is even easier to estimate than the P_lm's. I checked in > > >> GSL and alglib but alas I could not find this function. > > >> > > > > Not easy problem, rather difficult to find ready to use solution. > > > > For cos(?) close to 1.0 it could be written as cos(?)=1-t. Any > > polynomial of type W(1-t) would have terms 1,t,t^2,t^3...t^n. > > The term sin(?)^m is much worse, it ends with t^(m^2). > > > > For t quite small, say 1e-3, t^6 is below standard IEEE > > arithmetic machine precision so this term and higher terms would > > not affect the results. > > > > One of possible solution is to use arbitrary/multi-precision > > library. Conversion value of cos(?) into multiprecision allow you > > to compute your expression without loss of accuracy, except > > initial and final conversion. > > > > From my experience with ,,GNU Multiple Precision Arithmetic > > Library'' it needs half an hour to study interface and then it > > works. Many others libraries are available. > > > > The clear deficiency of such a library use is that evaluation of > > your expression would be very slow. This may be acceptable or not > > depending of the purpose of your routine. > > > > Trying to be as precisely as possible > > AMX > > > > > > -- > > adres w rot13