Suppose I know that a function from $[0,\pi] \to \mathbb{R}$ may be written as

$$ \sum_{k=0}^\infty A_l \frac{2l+1}{4\pi} P_l(r) $$

where $A_l$ all are known. Is there a way in which I may very quickly approximate the value of the function? My naive implementation is very slow and also suffers problems with numerical issues stemming from adding the very small numbers for certain $l$ and $r$ to large numbers.

A package or something in whatever language, Python, Julia, Fortran, etc, anything goes really, would be really appreciated.

  • $\begingroup$ Do you know the original function? Also, did you try computing the summation in reverse order? $\endgroup$ – nicoguaro Nov 26 '19 at 12:56
  • $\begingroup$ nope, that's the point is that I only know the coefficients $A_l$, and yes, but the evaluation kind of breaks for large L $\endgroup$ – eja Nov 26 '19 at 12:57
  • $\begingroup$ Does the problem for large $l$ arises from $A_l$ or $P_l$? $\endgroup$ – nicoguaro Nov 26 '19 at 14:56
  • $\begingroup$ oh, sorry for being unclear. In my naive attempts, P_l becomes impossible to evaluate for large l, even without $A_l$. Moreover, it is very, very slow. I am going to have to evaluate it in several points on the interval $[0,\pi]$, and I have to include a lot of terms, so it will be less than efficient... $\endgroup$ – eja Nov 26 '19 at 15:41
  • $\begingroup$ I think that those details might be important enough to be included in the question. Maybe what you need is a fast and reliable way of evaluating $P_l$ for large $l$. $\endgroup$ – nicoguaro Nov 26 '19 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.