add eta() implementing the Dedekind eta function

This commit is contained in:
fredrik
2019-07-16 15:59:34 +02:00
parent ac5f60fd17
commit b8ea24aa1f
4 changed files with 34 additions and 0 deletions
+1
View File
@@ -50,6 +50,7 @@ doc/source/_build/
# Files generated by setupegg.py
mpmath.egg-info/
.eggs
# Coverage-related files
.coverage
+5
View File
@@ -91,6 +91,11 @@ Jacobi elliptic functions
Modular functions
......................
:func:`eta`
^^^^^^^^^^^^^^^
.. autofunction:: mpmath.eta(tau)
:func:`kleinj`
^^^^^^^^^^^^^^^
.. autofunction:: mpmath.kleinj(tau=None, **kwargs)
+1
View File
@@ -47,6 +47,7 @@ qbarfrom = mp.qbarfrom
ellipfun = mp.ellipfun
jtheta = mp.jtheta
kleinj = mp.kleinj
eta = mp.eta
qp = mp.qp
qhyper = mp.qhyper
+27
View File
@@ -64,6 +64,33 @@ between the various parameters (:func:`~mpmath.qfrom`, :func:`~mpmath.mfrom`,
from .functions import defun, defun_wrapped
@defun_wrapped
def eta(ctx, tau):
r"""
Returns the Dedekind eta function of tau in the upper half-plane.
>>> from mpmath import *
>>> mp.dps = 25; mp.pretty = True
>>> eta(1j); gamma(0.25) / (2*pi**0.75)
(0.7682254223260566590025942 + 0.0j)
0.7682254223260566590025942
>>> tau = sqrt(2) + sqrt(5)*1j
>>> eta(-1/tau); sqrt(-1j*tau) * eta(tau)
(0.9022859908439376463573294 + 0.07985093673948098408048575j)
(0.9022859908439376463573295 + 0.07985093673948098408048575j)
>>> eta(tau+1); exp(pi*1j/12) * eta(tau)
(0.4493066139717553786223114 + 0.3290014793877986663915939j)
(0.4493066139717553786223114 + 0.3290014793877986663915939j)
>>> f = lambda z: diff(eta, z) / eta(z)
>>> chop(36*diff(f,tau)**2 - 24*diff(f,tau,2)*f(tau) + diff(f,tau,3))
0.0
"""
if ctx.im(tau) <= 0.0:
raise ValueError("eta is only defined in the upper half-plane")
q = ctx.expjpi(tau/12)
return q * ctx.qp(q**24)
def nome(ctx, m):
m = ctx.convert(m)
if not m: