from __future__ import division
from sympy import *
x, y, z, t = symbols('x y z t')
k, m, n = symbols('k m n', integer=True)
f, g, h = symbols('f g h', cls=Function)
In [1]: residue(tanh(x), x, 3*I*pi/2)
---------------------------------------------------------------------------
PoleError Traceback (most recent call last)
/.../.../<ipython-input-1-06ae92309a12> in <module>()
----> 1 residue(tanh(x), x, 3*I*pi/2)
/usr/lib/python2.7/dist-packages/sympy/series/residues.pyc in residue(expr, x, x0)
43 if x0 != 0:
44 expr = expr.subs(x, x+x0)
---> 45 s = expr.series(x, 0, 0).removeO()
46 # TODO: this sometimes helps, but the series expansion should rather be
47 # fixed, see #1627:
/usr/lib/python2.7/dist-packages/sympy/core/expr.pyc in series(self, x, x0, n, dir)
1560
1561 if n != None: # nseries handling
-> 1562 s1 = self._eval_nseries(x, n=n, logx=None)
1563 o = s1.getO() or S.Zero
1564 if o:
/usr/lib/python2.7/dist-packages/sympy/core/function.pyc in _eval_nseries(self, x, n, logx)
378 term = e.subs(x, S.Zero)
379 if term.is_bounded is False or term is S.NaN:
--> 380 raise PoleError("Cannot expand %s around 0" % (self))
381 series = term
382 fact = S.One
PoleError: Cannot expand tanh(x + 3*I*pi/2) around 0