Reputation: 4784
I need the EllipticTheta function in mathematica, I don't know if there is a corresponding function in numpy. Especially the second kind of it.
Upvotes: 3
Views: 928
Reputation: 35145
Try this: http://www.google.com/search?q=python+elliptic+theta
mpmath has the jacobi theta functions:
http://docs.sympy.org/0.7.6/modules/mpmath/functions/elliptic.html#jacobi-theta-functions
If you want a vectorized function, you can write
import mpmath
import numpy as np
jtheta = np.vectorize(mpmath.jtheta, 'D')
print(jtheta(1,2,1j*np.linspace(0,0.9,15)))
Note that np.vectorize
does not speed it up --- it just allows
it to work directly on array inputs. mpmath functions work with
arb. precision floats, so they can sometimes be slower than equivalent
functions implemented in machine-precision fp.
Upvotes: 3