/* -*- gp-script -*- */ \\% Eta-products, Ramanujan functions, Eisenstein series. \\ Author: Joerg Arndt \\ License: GPL version 3 or later \\ online at http://www.jjj.de/pari/ \\ version: 2021-February-14 (08:20) read("aux-chks.gpi"); \\ for chkS_() \\read("lambert.gpi"); \\ for (commented out method for) Etax_xderiv() Eta(q, S=-1)= \\ Return (eta-product:) prod( n>=1, 1 - q^n ). \\ Computation via the pentagonal number theorem. \\ As series correct up to order floor(3/2 * S^2). { my( et=1, qn=q, q3n2=q, q3=q^3, tt=1, ttq ); S=chkS_(S); \\ return( prod( n=1, S*S*3\2, 1-q^n ) ); \\ return( 1+sum(n=1, S, (-1)^n*(q^(n*(3*n-1)/2)+q^(n*(3*n+1)/2))) ); \\ return( 1+sum(n=1, S, (-1)^n*q^(n*(3*n-1)/2)*(1+q^n)) ); for (n=1, S, tt *= q3n2; ttq = tt * (1+qn); if ( bitand(n, 1), et-=ttq, et+=ttq ); qn *= q; q3n2 *= q3; ); return( et ); } /* ----- */ \\ == A010815 Eta_pow3(q, S=-1)= \\ Return Eta(q)^3 = sum(n>=0, (-1)^n*(2*n+1)*q^(n*(n+1)/2) ). { S=chkS_(S); return( sum(n=0, S, (-1)^n*(2*n+1)*q^(n*(n+1)\2) ) ); } /* ----- */ \\ == A010816 Eta_qderiv(q, S=-1)= \\ Return derivative (with respect to q) of eta-product. \\ As series correct up to order floor(3/2 * S^2). { S=chkS_(S); return( sum(n=1, S, (-1)^n*( (n*(3*n-1)/2) * q^(n*(3*n-1)/2-1) + (n*(3*n+1)/2) * q^(n*(3*n+1)/2-1) ) ) ); } /* ----- */ \\ cf. A147843 Eta_plus(q, S=-1)= \\ Return prod( n>=1, 1 + q^n ) \\ As series correct up to order floor(3/2 * S^2). { S=chkS_(S); return( Eta(q^2, S) / Eta(q, S) ); } /* ----- */ \\ == A000009 Expansion of prod(m>=1, 1 + q^m) Eta_plus_qderiv(q, S=-1)= \\ Return derivative (with respect to q) of eta-plus-product. \\ As series correct up to order floor(3/2 * S^2). { my(e1, e2, de1, de2); S=chkS_(S); e1 = Eta(q, S); e2 = Eta(q^2, S); de1 = Eta_qderiv(q, S); de2 = sum(n=1, S\2+1, (-1)^n*( (n*(3*n-1)) * q^(n*(3*n-1)-1) + (n*(3*n+1)) * q^(n*(3*n+1)-1) ) ); return( (de2*e1-e2*de1)/(e1^2) ); } /* ----- */ \\ == A066189 Sum of all partitions of n into distinct parts. 0 Etax_plus(q, x, S=-1)= \\ Return q-exponential series Exp_q(x) = prod( n>=0, 1 + x*q^n ) \\ computed as sum(n=0, S, x^n*q^(n*(n-1)/2) / prod(k=1, n, 1-q^k) ) \\ As series in q correct up to order floor(S^2/2). { my(xn=1, qn=1, qn2=1, pr=1, ret=1); S=chkS_(S); \\ return( prod(n=0, S*S\2, 1+x*q^n) ); \\ return( sum(n=0, S, x^n*q^(n*(n-1)/2) / prod(k=1, n, 1-q^k) ) ); for (n=1, S, \\ ret += x^n*q^(n*(n-1)/2) / prod(k=1, n, 1-q^k); xn *= x; \\ == x^n qn2 *= qn; qn *= q; \\ qn2 == q^(n*(n-1)/2) pr /= (1-qn); \\ pr == 1/prod(k=1, n, 1-q^k); ret += ( xn*qn2 * pr ); ); return( ret ); } /* ----- */ \\ \\ Etax_plus(q, q) = Eta_plus(q). \\ Etax_plus(q, x) = Etax(q, -x). \\ 1 / Etax_plus(q, x) = sum(n>=0, (-x)^n/prod(k=1, n, 1-q^k ) ). \\ Etax_plus(q, x) = Exp_q(q, x). \\ Etax_plus(q, (1-q)*x) = Exp_Q(q, x). Etax(q, x, S=-1)= \\ Return inverse q-exponential series 1/exp_q(x) = prod( n>=0, 1 - x*q^n ) \\ As series in q correct up to order floor(S^2/2). { S=chkS_(S); \\ return( prod(n=0, S*S\2, 1-x*q^n) ); return( Etax_plus(q, -x, S) ); } /* ----- */ \\ \\ Write E(q, x) for Etax(q, x) and P(q, x) for Etax_plus(q, x), then \\ \\ E(q, +x) = P(q, -x). \\ E(q, q) = Eta(q). \\ \\ E(q,x) = sum(n=0, S, (-x)^n * q^(n*(n-1)/2) / prod(k=1, n, 1 - q^k) ) \\ \\ 1 / E(q, x) = sum(n>=0, x^n / prod(k=1, n, 1-q^k ) ) = \\ = exp_q(q, x) = \\ = exp( sum(n>=1, ( 1/n * x^n ) / (1 - q^n) ) ). \\ \\ 1 / E(q, (1-q)*x) = 1 / prod(n>=0, 1 - x*(1-q)*q^n ) \\ = exp_Q(q, x) = \\ = sum(n>=0, x^n/prod(k=1, n, (1 - q^k)/(1 - q) ) ) = \\ = exp( sum(n>=1, ( 1/n * x^n * (1 - q)^n ) / (1 - q^n) ) ). \\ \\ E(+q, +x) * E(+q, -x) = P(+q^2, -x^2) = E(+q^2, +x^2) \\ E(+q, +I*x) * E(+q, -I*x) = P(+q^2, +x^2) \\ \\ E(+q, +x^2) = E(+q, +x) * E(+q, -x) * E(+q^2, +q*x^2) \\ Now replace x by I*x to obtain \\ P(+q, +x^2) = E(+q, +I*x) * E(+q, -I*x) * E(+q^2, -q*x^2) = \\ = P(+q^2, +x^2) * E(+q^2, -q*x^2) = \\ = P(+q^2, +x^2) * P(+q^2, +q*x^2) = \\ = E(+q^2, -x^2) * E(+q^2, -q*x^2) \\ \\ Multiplicative splitting: \\ E(q, x) = prod( s=0, M-1, E(q^M, q^s * x) ) for M>=1 \\ For example, \\ E(q, x) = E(q^2, x) * E(q^2, q * x) \\ E(q, x) = E(q^3, x) * E(q^3, q * x) * E(q^3, q^2 * x) \\ The identities also hold for P(q, x). Etax_xderiv(q, x, S=-1)= \\ Derivative of Etax(q, x) with respect to x. \\ Computation as sum(n>=1, -n * (-x)^(n-1) * q^(n*(n-1)/2) / prod(k=1, n, 1 - q^k) ). \\ Etax_xderiv(q, x) = Etax(q, x)^2 * sum(n>=1, -n * x^(n-1) / prod(k=1, n, 1 - q^k) ) { \\ Alternative method using generalized Lambert series: \\ my(L, E); \\ L=lambert_G0(q, x, S); \\ E=Etax(q, x, S); \\ return( (-1/x)*E*L ); my(xn=-1, qn=1, qn2=1, pr=1, ret=0); S=chkS_(S); \\ return( sum(n=1, S, -n * (-x)^(n-1) * q^(n*(n-1)/2) / prod(k=1, n, 1-q^k) ) ); for (n=1, S, \\ ret += ( -n * (-x)^(n-1) * q^(n*(n-1)/2) ) / prod(k=1, n, 1-q^k); qn2 *= qn; qn *= q; \\ qn2 == q^(n*(n-1)/2) pr /= (1-qn); \\ pr == 1/prod(k=1, n, 1-q^k); ret += ( n * xn*qn2 * pr ); xn *= -x; \\ == x^(n-1) ); return( ret ); } /* ----- */ Etax_plus_xderiv(q, x, S=-1)= \\ Derivative of Etax_plus(q, x) with respect to x. \\ Etax_plus_xderiv(q, x) = -Etax_xderiv(q, -x, S) ). { \\ return( -Etax_xderiv(q, -x, S) ); my(xn=1, qn=1, qn2=1, pr=1, ret=0); S=chkS_(S); \\ return( sum(n=1, S, n * x^(n-1) * q^(n*(n-1)/2) / prod(k=1, n, 1-q^k) ) ); for (n=1, S, \\ ret += n * x^(n-1) * q^(n*(n-1)/2) / prod(k=1, n, 1-q^k); qn2 *= qn; qn *= q; \\ qn2 == q^(n*(n-1)/2) pr /= (1-qn); \\ pr == 1/prod(k=1, n, 1-q^k); ret += ( n * xn*qn2 * pr ); xn *= x; \\ == x^(n-1) ); return( ret ); } /* ----- */ Eta_msect(q, s, m, S=-1)= \\ Multisection of eta-product: \\ return series prod( n>=1, 1-q^n ) \\ but only terms q^k such that k == s (mod m) { my(et_, qq); S=chkS_(S); \\ eta(q) == 1 + sum(n=1, S, (-1)^n * q^(n*(3*n-1)/2) * (1+q^n) ) et_ = if(s==0, 1, 0); for (n=1, S, qq = (n*(3*n-1)/2); if ( (qq%m)==s, et_ += (-1)^n*q^qq); qq = (n*(3*n+1)/2); if ( (qq%m)==s, et_ += (-1)^n*q^qq); ); return( et_ ); } /* ----- */ \\ ellj(q^2): \\ellj_q2(q, S)= \\{ \\ my(kp2, kp4); \\ kp2 = ellkprime(q, S)^2; \\ kp4 = kp2^2; \\ return( 256 * (1-kp2+kp4)^3 / (kp4*(1-kp2)^2) ); \\} /* ----- */ ellj_q(q, S=-1)= \\ Same as ellj(q), but this one does not switch to ellj(tau) for complex arguments { S=chkS_(S); \\ my(e1, e2); \\ e1=Eta(q, S); e2=Eta(q^2, S); \\ ((e1^24 + 256 * q *e2^24) / (e1 * e2)^8)^3 / (q * e1^24) \\ (256*e2^24*q + e1^24)^3/(e2^24*e1^48*q) my(P1, P2); P1=Eta(q, S)^24; P2=Eta(q^2, S)^24; return( (P1 + 256*q*P2)^3 / (q*P1^2*P2) ); } /* ----- */ \\ == A000521 Expansion of modular function j as power series in q. \\ Ramanujan functions and Eisenstein series: ram_ff(a, b, S=-1)={S=chkS_(S); sum(n=-S, S, a^(n*(n+1)/2) * b^(n*(n-1)/2));} \\ == (-a, a*b) * (-b, a*b) * (a*b, a*b) where (a, b) = Etax(b, a) = Etax_plus(b, -a) \\ == ram_ff(b, a) \\ ram_ff(q*w, q/w) == sum(n>=0, q^(n^2)*( w^n + 1/w^n ) \\ Theta3(q) = ram_ff(+q, +q) \\ Theta4(q) = ram_ff(+q, -q) \\ Theta4(q^4) = ram_ff(-q, -q) ram_f(q, S=-1)=Eta(-q, S); \\ ram_f(-q) == ram_ff(-q, -q^2) \\ == A121373 Expansion of f(x) = f(x, -x^2) \\ram_phi(q, S=-1)=Theta3(q, S); \\ dependency on theta.gpi ram_phi(q, S=-1)={ S=chkS_(S); return( 1 + 2*sum(n=1, S, q^(n^2)) ); } \\ == A000122 Expansion of Jacobi theta function theta_3(x) ram_chi(q, S=-1)=Eta(q^2, S)^2/(Eta(q, S)*Eta(q^4, S)); \\ == (1+q)*(1+q^3)*(1+q^5)*(1+q^7)*... \\ == A000700 Expansion of prod(k>=0, 1+x^(2k+1)) ram_psi(q, S=-1)={S=chkS_(S); sum(n=0, S, q^(n*(n+1)/2));} \\ == Theta2_q4(sqrt(q))/2 \\ == A010054 a(n) = 1 if n is a triangular number else 0. \\ Eisenstein series: \\ OEIS: A006352 (E_2), A004009 (E_4), A013973 (E_6), A008410 (E_8), A013974 (E_10), \\ A029828 (E_12), A058550 (E_14), A029829 (E_16), A029830 (E_20), A029831 (E_24). \\ missing in OEIS: E18, E22 eisenstein_E2(q, S=-1)= { \\Return Eisenstein series E2(q) = 1 - 24 * sum(n>=1, n * q^n/(1-q^n) ). \\ cf. http://oeis.org/A006352 S=chkS_(S); return( 1 + 24 *q * Eta_qderiv(q, S) / Eta(q, S) ); } /* ----- */ ram_L(q,S=-1)=eisenstein_E2(q,S); ram_P(q,S=-1)=eisenstein_E2(q,S); \\ == A006352 Expansion of Eisenstein series E_2 eisenstein_E4(q, S=-1)= { \\ Return Eisenstein series E4(q) = 1 + 240 * sum(n>=1, n^3 * q^n/(1-q^n) ). \\ cf. http://oeis.org/A004009 my(e1, e2); S=chkS_(S); e1 = Eta(q,S); e2 = Eta(q^2,S); return( (e1^24 + 256*q*e2^24) / (e1*e2)^8 ); \\ return( ram_phi(-q,S)^8 - (2*ram_phi(-q,S) * ram_phi(q,S))^4 + 16 * ram_phi(q,S)^8 ); } /* ----- */ ram_M(q,S=-1)=eisenstein_E4(q,S); ram_Q(q,S=-1)=eisenstein_E4(q,S); \\ == A004009 Expansion of Eisenstein series E_4(q) eisenstein_E6(q, S=-1)= { \\ Return Eisenstein series E6(q) = 1 - 504 * sum(n>=1, n^5 * q^n/(1-q^n) ). \\ == T3^4 * T4^4 + T2^4 * (T3^4 - T4^4) where Tn = Theta_n \\ cf. http://oeis.org/A013973 my( A1, A2, A4 ); S=chkS_(S); A1 = Eta(q,S)^8; A2 = Eta(q^2,S)^12; A4 = 32 * q * Eta(q^4,S)^8; return( (A1 + A4) * (A1^2 - 16*A1*A4 - 8*A4^2) / A2 ); } /* ----- */ ram_N(q,S=-1)= eisenstein_E6(q,S); ram_R(q,S=-1)= eisenstein_E6(q,S); \\ == A013973 Expansion of Eisenstein series E_6(q) \\ Eisenstein series: \\ E_{2*n} = 1 + (-1)^n * A006863(n) * sum(k>=1, q^k * sigma_{2*n-1}(k) ) \\ From http://en.wikipedia.org/wiki/Eisenstein_series \\ E8 = E4^2 \\ E10 = E4 * E6 \\ E12 = 1/691 * (441 * E4^3 + 250 * E6^2) \\ E14 = E4^2 * E6 \\ E16 = 1/3617 * (1617 * E4^4 + 2000 * E4 * E6^2) \\ E18 = 1/43867 * (38367 * E4^3 * E6 + 5500 * E6^3) \\ E20 = 1/174611 * (53361 * E4^5 + 121250 * E4^2 * E6^2) \\ E22 = 1/77683 * (57183 * E4^4 * E6 + 20500 * E4 * E6^3) \\ E24 = 1/236364091 * (49679091 * E4^6 + 176400000 * E4^3 * E6^2 + 10285000 * E6^4) \\ Cf. A001067 for 1,1,1,1,691,1,3617,43867,174611,77683,236364091 eisenstein_E8(q, S=-1)= eisenstein_E4(q, S)^2; \\ == A008410 eisenstein_E10(q, S=-1)= eisenstein_E4(q, S)*eisenstein_E6(q, S); \\ == A013974 eisenstein_E12(q,S=-1)= 1/691 * ( 441 * eisenstein_E4(q,S)^3 + 250 * eisenstein_E6(q,S)^2 ); \\ == A029828 / 691 eisenstein_E14(q,S=-1)= eisenstein_E4(q,S)^2 * eisenstein_E6(q,S); \\ == A058550 eisenstein_E16(q,S=-1)= {my(E4=eisenstein_E4(q,S),E6=eisenstein_E6(q,S)); 1/3617 * ( 1617 * E4^4 + 2000 * E4 * E6^2 );} \\ == A029829 / 3617 eisenstein_E18(q,S=-1)= {my(E4=eisenstein_E4(q,S),E6=eisenstein_E6(q,S)); 1/43867 * ( 38367 * E4^3 * E6 + 5500 * E6^3 );} \\ == A000000 / 43867 eisenstein_E20(q,S=-1)= {my(E4=eisenstein_E4(q,S),E6=eisenstein_E6(q,S)); 1/174611 *( 53361 * E4^5 + 121250 * E4^2 * E6^2 );} \\ == A029830 / 174611 eisenstein_E22(q,S=-1)= {my(E4=eisenstein_E4(q,S),E6=eisenstein_E6(q,S)); 1/77683 * ( 57183 * E4^4 * E6 + 20500 * E4 * E6^3 );} \\ == A000000 / 77683 eisenstein_E24(q,S=-1)= {my(E4=eisenstein_E4(q,S),E6=eisenstein_E6(q,S)); 1/236364091 * ( 49679091 * E4^6 + 176400000 * E4^3 * E6^2 + 10285000 * E6^4 );} \\ == A029831 / 236364091 \\ ==== end of file ====