numpy中是否存在elliptictheta函数?

时间:2015-10-16 11:13:34

标签: numpy

我需要mathematica中的EllipticTheta函数,我不知道numpy中是否有相应的函数。特别是它的第二种。

1 个答案:

答案 0 :(得分:2)

试试这个:http://www.google.com/search?q=python+elliptic+theta

mpmath有jacobi theta函数:

http://docs.sympy.org/0.7.6/modules/mpmath/functions/elliptic.html#jacobi-theta-functions

如果你想要一个矢量化函数,你可以写

import mpmath
import numpy as np

jtheta = np.vectorize(mpmath.jtheta, 'D')

print(jtheta(1,2,1j*np.linspace(0,0.9,15)))

请注意np.vectorize不会加速它 - 它只是允许 它直接在数组输入上工作。 mpmath函数可以使用 套利。精度漂浮,所以它们有时可能慢于等效 在机器精度fp中实现的函数。