Description
Hi,
when working with complex impedance data, i encountered an issue and narrowed it down to:
from numpy import *
x=(616.47292227535877+53.814558958179042j)tanh(x)
Warning (from warnings module):
File "C:\python\Test\Impedance class reduced.py", line 1
from numpy import *
RuntimeWarning: overflow encountered in tanh
Warning (from warnings module):
File "C:\python\Test\Impedance class reduced.py", line 1
from numpy import *
RuntimeWarning: invalid value encountered in tanh
When actually, it should return (1-0j), see http://tinyurl.com/nm4goq3
Then i tried
sinh(x)/cosh(x)
Warning (from warnings module):
File "C:\python\Test\Impedance class reduced.py", line 1
from numpy import *
RuntimeWarning: overflow encountered in cdouble_scalars
Warning (from warnings module):
File "C:\python\Test\Impedance class reduced.py", line 1
from numpy import *
RuntimeWarning: invalid value encountered in cdouble_scalars
(nan+nan*j)
However, the solution was to use numpy.divide:
divide(sinh(x),cosh(x))
(1-0j)
This took me quite some time to figure out, so i guess it would be a good idea to include it in the next release (maybe even with with coth?).
Thanks a lot!