# How to compute Dedekind eta function efficiently?

According to wiki: https://en.wikipedia.org/wiki/Dedekind_eta_function, Dedekind eta function is defined in many equivalent forms. But none of them is an explicit description (say in algorithmic format) on how to computing it. Where to find such one? Thanks!

Euler's formula

$$\sum\limits_{n \in \mathbb{Z}} {( - 1)^n q^{\frac{{(3n^2 - n)}} {2}} } = \prod\limits_{n = 1}^\infty {(1 - q^n ),}$$

(which can be proven from Jacobi’s triple product identity by using the fact that $\prod\limits_{n = 1}^\infty {(1 - q^{3n} )(1 - q^{3n - 2} )} (1 - q^{3n - 1} ) = \prod\limits_{n = 1}^\infty {(1 - q^n )}$) provides a good way of numerically computing

$$\eta (\tau )=e^{\frac {\pi {\rm {{i}\tau }}}{12}}\prod _{n=1}^{\infty }(1-e^{2n\pi {\rm {{i}\tau }}})=q^{\frac {1}{24}}\prod _{n=1}^{\infty }(1-q^{n}).$$

My maple code of Gatteschi-Sokal algorithm for computing $R(t,x)=\prod_{n=1}^{\infty}(1-tx^n)$:

GS:=proc(t,x,prec)

local R0, a0, b0, Rn, an, bn, d, c, i, N, r, Rd;

N := 100;

d := 1/2; if d = t*x then d := (1/2)*d end if;

r := evalf$[prec]$(1+d/(1-x));

a0 := 1; b0 := evalf$[prec]$(d/(d-t*x));

R0 := evalf$[prec]$(r*a0+(1-r)*b0);

i := 0;

while i < N do

c := evalf$[prec]$(a0*(d*a0+(1.0-d)*b0));

an := evalf$[prec]$(c/b0);

bn := evalf$[prec]$(c/(x*a0+(1.0-x)*b0));

Rn := evalf$[prec]$(r*an+(1.0-r)*bn);

Rd := evalf$[prec]$(abs(Rn-R0));

if Rd < 10^(-prec) then i := N else

a0 := an; b0 := bn; R0 := Rn; i := i+1 end if;

end do;

return Rn;

end proc;

eta:=(t,prec)->evalf$[prec]$(GS(1,exp($2*Pi*I*t$),prec));

Dedekind_eta := (t, prec)-> evalf$[prec]$(exp($1/12*Pi*I*t$)*eta(t, prec));

Test:

t:=0.3*I:

eta(t,40); Dedekind_eta(t,40);

0.8251926470787677741036466781518992636742

0.7628619270903183863013294748250092216042

Almost same with PARI/GP output:

eta(0.3*I,0)=0.82519264707876777410364667815189926367

eta(0.3*I,1)=0.76286192709031838630132947482500922160