scipy/scipy — pull request #3081 by endolith (2013-11-19 03:53:16+00:00)
Title: BUG: buttap() should produce a purely real pole

Previously buttap for odd orders produced a pole like -1+6.1e-17j rather than -1+0j exactly. This makes poly(p) complex, though all the imaginary parts are negligible.

Now the calculation is symmetrical, so the middle term works out to -exp(0j), which is exactly -1+0j.

Discussion here: http://mail.scipy.org/pipermail/scipy-dev/2013-February/018376.html

cheb1ap and cheb2ap have the same issue, but I didn't change those yet.

Also should add some kind of test like this:

```
odd_orders = arange(1, 26, 2)

for N in odd_orders:
funcs = (
buttap(N)[1],
besselap(N)[1],
cheb1ap(N, 1)[1],
cheb2ap(N, 20)[1],
ellipap(N, 1, 20)[1],
)

for p in funcs:
# One pole is exactly real
assert any(imag(p) == 0)

# All other poles are exact conjugates
assert all(imag(poly(p)) == 0)
```