Dedekind eta function in sage
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).
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