JuliaLang/julia — pull request #7125 by stevengj (2014-06-05 02:42:54+00:00)
Title: RFC: add complex polygamma and Hurwitz zeta functions

This replaces the old `polygamma(m,z)` implementation for #7033. The new one seems to be around the same speed for real arguments `z`, but the same code also works for complex `z`, and it also handles negative `z`. I also added specialized `digamma` and `trigamma` implementations supporting real and complex arguments. The new `trigamma` is much faster, almost 10x faster, than the old generic one based on `polygamma`. The new `digamma` seems to be about the same speed as the old `digamma` for real arguments, but is simpler and supports both real and complex `z`.

However, I still seem to be hitting #7060. My `@chorner` macro is supposed to fall back to `@horner` automatically for real arguments, but manually replacing `@chorner` with `@horner` for real arguments makes the `digamma` function 5x faster. cc: @carnaval

As a bonus, the way I implemented polygamma gives us the [Hurwitz zeta function](http://en.wikipedia.org/wiki/Hurwitz_zeta_function) `zeta(s,z)` = ζ(s, z) for free, at least for `real(s) ≥ 1`. This is a common generalization of the Riemann zeta function `zeta(s)` = ζ(s) = ζ(s, 1), which we already export.