# Special functions , associated Legendre type 3

**URL:** <https://discourse.julialang.org/t/special-functions-associated-legendre-type-3/2163>\
**Category:** Numerics\
**Created:** [February 18, 2017, 1:06am UTC](https://discourse.julialang.org/t/special-functions-associated-legendre-type-3/2163 "2017-02-18T01:06:12Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [February 18, 2017, 12:53pm UTC](https://discourse.julialang.org/t/special-functions-associated-legendre-type-3/2163/5 "2017-02-18T12:53:25Z")

</div>

[GitHub - JuliaMath/SpecialFunctions.jl: Special mathematical functions in Julia](https://github.com/JuliaMath/SpecialFunctions.jl) is becoming the main repo for special functions.

Note, however, that it looks like your code can be substantially improved. For on thing, the integer type used should depend on the type of the arguments—you shouldn’t unconditionally convert to BigInt. Also, when you’re computing polynomial series, you almost never want to compute each term in the series independently (with calls to `^`, `factorial`, `binomial` etcetera). Instead, you want to compute each term as a recurrence from the previous term, analogous to Horner’s method. (This also helps to avoid overflow from the individual terms in ratios of factorials.)

See, for example, how I compute the Taylor series for the exponential integral in this notebook: [https://github.com/mitmath/18S096/blob/iap2017/pset3/pset3-solutions.ipynb](https://github.com/mitmath/18S096/blob/iap2017/pset3/pset3-solutions.ipynb)

---

_[View the full topic](https://discourse.julialang.org/t/special-functions-associated-legendre-type-3/2163)._
