# Dedekind eta function in sage

Anonymous

I would like to use the dedekind eta function, $q^{\frac{1}{24}}\prod_{n=1}(1-q^n)$, in my code. However when I do

N = 20
R.<q> = PowerSeriesRing(QQ,default_prec=p*N+1)

eta = q^(1/24) * prod([(1-q^n) for n in range(1,N)])
eta = R(eta.truncate(N))


I get "ValueError: power series valuation is not a multiple of 24". I would like to know how I can implement the formula above or if there is some inbuilt eta function I can use somehow (I couldn't find anything in the documentation).

edit retag close merge delete

1

Not a SageMath way but you can try some Python libraries (and you can use them directly in SageMath): https://mpmath.org/doc/current/functions/qfunctions.html

( 2024-07-28 06:10:42 +0200 )edit

Sort by ยป oldest newest most voted

It's a always a good idea using the existing functionality rather than reinventing the wheel. Without the factor $q^{1/24}$ the expansion of eta function in Sage can be computed as follows:

from sage.modular.etaproducts import qexp_eta
N=20
qexp_eta(ZZ[['q']], N)

more

## Stats

Seen: 357 times

Last updated: Aug 14