You are not logged in.
BeginPackage["DedekindEta`"];
Unprotect[DedekindEta, LogDedekindEta];
ClearAll[LogDedekindEta]
Begin["`Private`"];
DedekindEta /: HoldPattern[Derivative[1][DedekindEta]] :=
DedekindEta[#]*LogDedekindEta'[#] &;
LogDedekindEta[z_] /; InexactNumberQ[z] && Im[z] > 0 :=
Block[{t = z, n, pr, f},
n = Round[Re[t]]; t -= n; pr = Precision[t];
f = If[7*Im[z] < 6,
n*Pi*I/12 + LogDedekindEta[SetPrecision[-1/t, pr]] - Log[-I*t]/2,
t = z*Pi*I;
t/12 + Log[QPochhammer[Exp[2*t]]],
Null
];
f /; NumberQ[f]
];
LogDedekindEta /: HoldPattern[Derivative[1][LogDedekindEta]] :=
With[{m = ModularLambda[#]},
With[{t = EllipticK[m]},
I*t*(EllipticE[m] + t*(m - 2)/3)/Pi
]
] &;
LogDedekindEta /: HoldPattern[E^LogDedekindEta[z_]] := DedekindEta[z];
LogDedekindEta /: MakeBoxes[LogDedekindEta[z_], TraditionalForm] :=
RowBox[{InterpretationBox["log\[Eta]", LogDedekindEta, Editable -> False, Selectable -> False, Tooltip -> "LogDedekindEta"], "(", ToBoxes[z], ")"}];
End[];
SetAttributes[LogDedekindEta, {Listable, NumericFunction, ReadProtected}];
Protect[DedekindEta, LogDedekindEta];
EndPackage[];
BeginPackage["KleinInvariantJ`"];
Unprotect[InverseKleinInvariantJ];
ClearAll[InverseKleinInvariantJ];
Begin["`Private`"];
InverseKleinInvariantJ[j_] :=
Module[{a},
Which[
PossibleZeroQ[j],
Return[(I*Sqrt[3] - 1)/2 + 4*I*(-j)^(1/3)*(Pi/(Gamma[1/3]^2))^3, Module],
PossibleZeroQ[a = j - 1],
Return[I + 8*I*Pi^2*Sqrt[a/3]/Gamma[1/4]^4, Module],
InexactNumberQ[j],
a = Tan[ArcCsc[Sqrt[j]]/3];
a *= 2/(a + Sqrt[3]);
a = I*ArithmeticGeometricMean[1, Sqrt[1 - a]]/ArithmeticGeometricMean[1, Sqrt[a]];
If[InexactNumberQ[a], Return[a, Module]],
Head[j] === DirectedInfinity,
Return[I*Infinity, Module]
];
Null /; False
];
InverseKleinInvariantJ /:
HoldPattern[KleinInvariantJ[InverseKleinInvariantJ[j_]]] := j;
InverseKleinInvariantJ /:
HoldPattern[Derivative[1][InverseKleinInvariantJ]] :=
I/(4*Sqrt[3]*Pi*DedekindEta[InverseKleinInvariantJ[#]]^4*#^(2/3)*Sqrt[# - 1]) &
InverseKleinInvariantJ /:
MakeBoxes[InverseKleinInvariantJ[j_], TraditionalForm] :=
RowBox[{InterpretationBox[SuperscriptBox["J", RowBox[{"-", "1"}]], InverseKleinInvariantJ, Editable -> False, Selectable -> False, Tooltip -> "InverseKleinInvariantJ"], "(", ToBoxes[j], ")"}];
End[];
SetAttributes[InverseKleinInvariantJ, {Listable, NumericFunction, ReadProtected}];
Protect[InverseKleinInvariantJ];
EndPackage[];
BeginPackage["EisensteinE`"];
Unprotect[EisensteinE];
ClearAll[EisensteinE];
Begin["`Private`"];
EisensteinE[2, q_] /; InexactNumberQ[q] && Abs[q] < 1 :=
Block[{q2 = q^2, qn = -1, qn2 = 1, a = 1, b = 1, k = 1, t},
While[qn *= q2; qn2 *= qn; k += 2; t = a + k^3*qn2; b += k*qn2; t != a, a = t];
t / b
];
EisensteinE[n_, q_] /; EvenQ[n] && n >= 4 && InexactNumberQ[q] && Abs[q] < 1 :=
Block[{q2 = q^2, qn = 1, k = 1, r = n - 1, s = 0, t},
While[qn *= q2; t = s + k^r*qn/(1 - qn); k++; t != s, s = t];
1 - 2*n*t/BernoulliB[n]
];
End[];
SetAttributes[EisensteinE, {Listable, NHoldFirst, NumericFunction, ReadProtected}];
Protect[EisensteinE];
EndPackage[];
Test cases:
Module[{q},
q = RandomReal[WorkingPrecision -> 50];
Assert[ResourceFunction["EisensteinE"][#, q] == EisensteinE[#, q]] & /@ Range[2,8,2];
] & // Block[{$AssertFunction = Automatic}, #[]] &;
BeginPackage["Lemniscate`"];
Unprotect[
LemniscateSin, LemniscateCos, LemniscateTan, LemniscateCot, LemniscateSinh, LemniscateCosh, LemniscateSinhPrime, LemniscateCoshPrime, LemniscateTanh, LemniscateCoth,
InverseLemniscateSin, InverseLemniscateCos, InverseLemniscateTan, InverseLemniscateCot, InverseLemniscateSinh, InverseLemniscateCosh, InverseLemniscateTanh, InverseLemniscateCoth
];
ClearAll[
LemniscateSin, LemniscateCos, LemniscateTan, LemniscateCot, LemniscateSinh, LemniscateCosh, LemniscateSinhPrime, LemniscateCoshPrime, LemniscateTanh, LemniscateCoth,
InverseLemniscateSin, InverseLemniscateCos, InverseLemniscateTan, InverseLemniscateCot, InverseLemniscateSinh, InverseLemniscateCosh, InverseLemniscateTanh, InverseLemniscateCoth
];
Begin["`Private`"];
LemniscateSin[z_] /; (z == 0) := z;
LemniscateSin[z_?InexactNumberQ] := JacobiSN[z, -1];
LemniscateSin /: HoldPattern[LemniscateSin'] :=
LemniscateCos[#]*(1 + LemniscateSin[#]^2) &;
LemniscateSin /: MakeBoxes[LemniscateSin[z_], TraditionalForm] :=
RowBox[{InterpretationBox["sl", LemniscateSin, Editable -> False, Selectable -> False, Tooltip -> "LemniscateSin"], "(", ToBoxes[z], ")"}]
LemniscateCos[z_] /; (z == 0) := 1 - z^2;
LemniscateCos[z_?InexactNumberQ] := JacobiCD[z, -1]
LemniscateCos /: HoldPattern[LemniscateCos'] :=
-LemniscateSin[#]*(1 + LemniscateCos[#]^2) &;
LemniscateCos /: MakeBoxes[LemniscateCos[z_], TraditionalForm] :=
RowBox[{InterpretationBox["cl", LemniscateCos, Editable -> False, Selectable -> False, Tooltip -> "LemniscateCos"], "(", ToBoxes[z], ")"}]
LemniscateTan[z_] /; (z == 0) := z;
LemniscateTan[z_?InexactNumberQ] :=
JacobiSC[z, -1]*Sqrt[JacobiCD[z, -1]];
LemniscateTan /: HoldPattern[LemniscateTan'] :=
LemniscateCot[#]^3 &;
LemniscateTan /: MakeBoxes[LemniscateTan[z_], TraditionalForm] :=
RowBox[{InterpretationBox["tl", LemniscateTan, Editable -> False, Selectable -> False, Tooltip -> "LemniscateTan"], "(", ToBoxes[z], ")"}]
LemniscateCot[z_] /; (z == 0) := 1 + z^4/4;
LemniscateCot[z_?InexactNumberQ] :=
JacobiNC[z, -1]*Sqrt[JacobiCD[z, -1]];
LemniscateCot /: HoldPattern[LemniscateCot'] :=
LemniscateTan[#]^3 &;
LemniscateCot /: MakeBoxes[LemniscateCot[z_], TraditionalForm] :=
RowBox[{InterpretationBox["ctl", LemniscateCot, Editable -> False, Selectable -> False, Tooltip -> "LemniscateCot"], "(", ToBoxes[z], ")"}]
LemniscateSinh[z_] /; (z == 0) := z;
LemniscateSinh[z_?InexactNumberQ] :=
JacobiSN[z, 1/2]*JacobiDC[z, 1/2];
LemniscateSinh /: HoldPattern[LemniscateSinh'] :=
LemniscateSinhPrime;
LemniscateSinh /: MakeBoxes[LemniscateSinh[z_], TraditionalForm] :=
RowBox[{InterpretationBox["slh", LemniscateSinh, Editable -> False, Selectable -> False, Tooltip -> "LemniscateSinh"], "(", ToBoxes[z], ")"}]
LemniscateSinhPrime[z_] /; (z == 0) := 1 + z^4/2;
LemniscateSinhPrime[z_?InexactNumberQ] :=
With[{t = JacobiCN[z, 1/2]^2},
(t + t^(-1))/2
];
LemniscateSinhPrime /: HoldPattern[LemniscateSinhPrime'] :=
2*LemniscateSinh[#]^3 &;
LemniscateSinhPrime /: MakeBoxes[LemniscateSinhPrime[z_], TraditionalForm] :=
RowBox[{InterpretationBox[SuperscriptBox["slh", "\[Prime]"], LemniscateSinhPrime, Editable -> False, Selectable -> False, Tooltip -> "LemniscateSinhPrime"], "(", ToBoxes[z], ")"}]
LemniscateCosh[z_] /; (z == 0) := z^(-1);
LemniscateCosh[z_?InexactNumberQ] :=
JacobiNS[z, 1/2]*JacobiCD[z, 1/2];
LemniscateCosh /: HoldPattern[LemniscateCosh'] :=
LemniscateCoshPrime;
LemniscateCosh /: MakeBoxes[LemniscateCosh[z_], TraditionalForm] :=
RowBox[{InterpretationBox["clh", LemniscateCosh, Editable -> False, Selectable -> False, Tooltip -> "LemniscateCosh"], "(", ToBoxes[z], ")"}]
LemniscateCoshPrime[z_] /; (z == 0) := -z^(-2);
LemniscateCoshPrime[z_?InexactNumberQ] :=
With[{t = JacobiSD[z, 1/2]^2},
-(t^(-1) + t/4)
];
LemniscateCoshPrime /: HoldPattern[LemniscateCoshPrime'] :=
2*LemniscateCosh[#]^3 &;
LemniscateCoshPrime /: MakeBoxes[LemniscateCoshPrime[z_], TraditionalForm] :=
RowBox[{InterpretationBox[SuperscriptBox["clh", "\[Prime]"], LemniscateCoshPrime, Editable -> False, Selectable -> False, Tooltip -> "LemniscateCoshPrime"], "(", ToBoxes[z], ")"}]
LemniscateTanh[z_] /; (z == 0) := z;
LemniscateTanh[z_?InexactNumberQ] :=
With[{t = JacobiSD[z, 1/2]},
t/Sqrt[1 + t^4/4]
];
LemniscateTanh /: HoldPattern[LemniscateTanh'] :=
LemniscateCoth[#]^3 &;
LemniscateTanh /: MakeBoxes[LemniscateTanh[z_], TraditionalForm] :=
RowBox[{InterpretationBox["tlh", LemniscateTanh, Editable -> False, Selectable -> False, Tooltip -> "LemniscateTanh"], "(", ToBoxes[z], ")"}]
LemniscateCoth[z_] /; (z == 0) := 1 - z^4/4;
LemniscateCoth[z_?InexactNumberQ] :=
JacobiCD[z, 1/2]*JacobiND[z, 1/2]/Sqrt[1 + JacobiSD[z, 1/2]^4/4];
LemniscateCoth /: HoldPattern[LemniscateCoth'] :=
-LemniscateTanh[#]^3 &;
LemniscateCoth /: MakeBoxes[LemniscateCoth[z_], TraditionalForm] :=
RowBox[{InterpretationBox["ctlh", LemniscateCoth, Editable -> False, Selectable -> False, Tooltip -> "LemniscateCoth"], "(", ToBoxes[z], ")"}]
InverseLemniscateSin[z_] := With[{t = z*Hypergeometric2F1[1/4, 1/2, 5/4, z^4]},
t /; FreeQ[t, Hypergeometric2F1]
];
InverseLemniscateSin /: HoldPattern[InverseLemniscateSin'] :=
(1 - #^4)^(-1/2) &;
InverseLemniscateSin /: HoldPattern[LemniscateSin[InverseLemniscateSin[z_]]] :=
z;
InverseLemniscateSin /: HoldPattern[LemniscateCos[InverseLemniscateSin[z_]]] :=
Sqrt[1 - z^2]/Sqrt[1 + z^2];
InverseLemniscateSin /: HoldPattern[LemniscateTan[InverseLemniscateSin[z_]]] :=
z/(1 - z^4)^(1/4);
InverseLemniscateSin /: HoldPattern[LemniscateCot[InverseLemniscateSin[z_]]] :=
(1 - z^4)^(-1/4);
InverseLemniscateCos[z_] := With[{t = InverseLemniscateSin[1] - InverseLemniscateSin[z]},
t /; FreeQ[t, InverseLemniscateSin]
];
InverseLemniscateCos /: HoldPattern[InverseLemniscateCos'] :=
-(1 - #^4)^(-1/2) &;
InverseLemniscateCos /: HoldPattern[LemniscateSin[InverseLemniscateCos[z_]]] :=
Sqrt[1 - z^2]/Sqrt[1 + z^2];
InverseLemniscateCos /: HoldPattern[LemniscateCos[InverseLemniscateCos[z_]]] :=
z;
InverseLemniscateCos /: HoldPattern[LemniscateTan[InverseLemniscateCos[z_]]] :=
Sqrt[1 - z^2]/(Sqrt[2]*Sqrt[z]);
InverseLemniscateCos /: HoldPattern[LemniscateCot[InverseLemniscateCos[z_]]] :=
Sqrt[1 + z^2]/(Sqrt[2]*Sqrt[z]);
InverseLemniscateTan[z_] := With[{t = z*Hypergeometric2F1[1/4, 3/4, 5/4, -z^4]},
t /; FreeQ[t, Hypergeometric2F1]
];
InverseLemniscateTan /: HoldPattern[InverseLemniscateTan'] :=
(1 + #^4)^(-3/4) &;
InverseLemniscateCot[z_] := With[{t = z*(1 - z^(-4))^(1/4)*Hypergeometric2F1[1/4, 3/4, 5/4, 1 - z^4]},
t /; FreeQ[t, Hypergeometric2F1]
];
InverseLemniscateCot /: HoldPattern[InverseLemniscateCot'] :=
(#^4 - 1)^(-3/4) &;
InverseLemniscateSinh[z_] := With[{t = z*Hypergeometric2F1[1/4, 1/2, 5/4, -z^4]},
t /; FreeQ[t, Hypergeometric2F1]
]
InverseLemniscateSinh /: HoldPattern[InverseLemniscateSinh'] :=
(1 + #^4)^(-1/2) &
InverseLemniscateSinh /: HoldPattern[LemniscateSinh[InverseLemniscateSinh[z_]]] :=
z;
InverseLemniscateSinh /: HoldPattern[LemniscateCosh[InverseLemniscateSinh[z_]]] :=
z^(-1);
InverseLemniscateSinh /: HoldPattern[LemniscateSinhPrime[InverseLemniscateSinh[z_]]] :=
Sqrt[1 + z^4];
InverseLemniscateSinh /: HoldPattern[LemniscateCoshPrime[InverseLemniscateSinh[z_]]] :=
Sqrt[1 + z^4]/z^2;
InverseLemniscateSinh /: HoldPattern[LemniscateTanh[InverseLemniscateSinh[z_]]] :=
z/(1 + z^4)^(1/4);
InverseLemniscateSinh /: HoldPattern[LemniscateCoth[InverseLemniscateSinh[z_]]] :=
(1 + z^4)^(-1/4);
InverseLemniscateCosh[z_] := With[{t = 2*InverseLemniscateSinh[1] - InverseLemniscateSinh[z]},
t /; FreeQ[t, InverseLemniscateSinh]
];
InverseLemniscateCosh /: HoldPattern[InverseLemniscateCosh'] :=
(1 + #^4)^(-1/2) &
InverseLemniscateCosh /: HoldPattern[LemniscateSinh[InverseLemniscateCosh[z_]]] :=
z^(-1);
InverseLemniscateCosh /: HoldPattern[LemniscateCosh[InverseLemniscateCosh[z_]]] :=
z;
InverseLemniscateCosh /: HoldPattern[LemniscateSinhPrime[InverseLemniscateCosh[z_]]] :=
-Sqrt[1 + z^4]/z^2;
InverseLemniscateCosh /: HoldPattern[LemniscateCoshPrime[InverseLemniscateCosh[z_]]] :=
-Sqrt[1 + z^4];
InverseLemniscateCosh /: HoldPattern[LemniscateTanh[InverseLemniscateCosh[z_]]] :=
(1 + z^4)^(-1/4);
InverseLemniscateCosh /: HoldPattern[LemniscateCoth[InverseLemniscateCosh[z_]]] :=
z/(1 + z^4)^(1/4);
InverseLemniscateTanh[z_] := With[{t = z*Hypergeometric2F1[1/4, 3/4, 5/4, z^4]},
t /; FreeQ[t, Hypergeometric2F1]
];
InverseLemniscateTanh /: HoldPattern[InverseLemniscateTanh'] :=
(1 + #^4)^(-3/4) &;
InverseLemniscateCoth[z_] := With[{t = InverseLemniscateTanh[1] - InverseLemniscateTanh[z]},
t /; FreeQ[t, InverseLemniscateTanh]
];
InverseLemniscateCoth /: HoldPattern[InverseLemniscateCoth'] :=
-(1 + #^4)^(-3/4) &;
End[];
SetAttributes[{
LemniscateSin, LemniscateCos, LemniscateTan, LemniscateCot, LemniscateSinh, LemniscateCosh, LemniscateSinhPrime, LemniscateCoshPrime, LemniscateTanh, LemniscateCoth,
InverseLemniscateSin, InverseLemniscateCos, InverseLemniscateTan, InverseLemniscateCot, InverseLemniscateSinh, InverseLemniscateCosh, InverseLemniscateTanh, InverseLemniscateCoth
}, {Listable, NumericFunction, ReadProtected}];
Protect[
LemniscateSin, LemniscateCos, LemniscateTan, LemniscateCot, LemniscateSinh, LemniscateCosh, LemniscateSinhPrime, LemniscateCoshPrime, LemniscateTanh, LemniscateCoth,
InverseLemniscateSin, InverseLemniscateCos, InverseLemniscateTan, InverseLemniscateCot, InverseLemniscateSinh, InverseLemniscateCosh, InverseLemniscateTanh, InverseLemniscateCoth
];
EndPackage[];
Special values:
Module[{w1, w2, w3, g2, g3, Δ, p, ζ, case},
w1 = RandomReal[WorkingPrecision -> 50];
z = w1*RandomReal[WorkingPrecision -> 50];
p[z_] := WeierstrassP[z, {g2, g3}];
ζ[z_] := WeierstrassZeta[z, {g2, g3}];
case[t_] := (w3 = t*w1; w2 = -w1 - w3; {g2, g3} = WeierstrassInvariants[{w1, w3}]; Δ = g2^3 - 27*g3^2);
case[I]; (* Lemniscatic cases *)
Assert[ζ[w1] == Pi/(4*w1)];
Assert[ζ[w3] == -I*Pi/(4*w1)];
Assert[p[w1] == Gamma[1/4]^4/(32*Pi*w1^2)];
Assert[p[w2] == 0];
Assert[p[w3] == -Gamma[1/4]^4/(32*Pi*w1^2)];
Assert[g2 == Gamma[1/4]^8/(16*Pi*w1^2)^2];
Assert[g3 == 0];
Assert[Δ == Gamma[1/4]^24/(16*Pi*w1^2)^6];
Assert[g2^3/Δ == 1];
Assert[p[(2/5)*w1] - p[(4/5)*w1] == Sqrt[GoldenRatio]*Gamma[1/4]^4/(16*Pi*w1^2)];
With[{x = p[z], y = p'[z]},
Assert[p[(1 + I)*z] == I*(g2/x - 4*x)/8];
Assert[p'[(1 + I)*z] == -(1 + I)*y*(g2/x^2 + 4)/16];
Assert[p[(1 + I)*z/2] == -I*x*(1 + Sqrt[4 - g2/x^2]/2)];
Assert[z == x^(-1/2)*Hypergeometric2F1[1/4, 1/2, 5/4, g2/(4*x^2)]];
];
case[Exp[2*Pi*I/3]]; (* Equianharmonic cases *)
Assert[ζ[w1] == Pi/(2*Sqrt[3]*w1)];
Assert[ζ[w2] == Exp[2*Pi*I/3]*Pi/(2*Sqrt[3]*w1)];
Assert[ζ[w3] == Exp[-2*Pi*I/3]*Pi/(2*Sqrt[3]*w1)];
Assert[p[w1] == Gamma[1/3]^6/(2^(14/3)*(Pi*w1)^2)];
Assert[p[w2] == Exp[-2*Pi*I/3]*Gamma[1/3]^6/(2^(14/3)*(Pi*w1)^2)];
Assert[p[w3] == Exp[2*Pi*I/3]*Gamma[1/3]^6/(2^(14/3)*(Pi*w1)^2)];
Assert[g2 == 0];
Assert[g3 == Gamma[1/3]^18/(4*Pi*w1)^6];
Assert[Δ == -27*Gamma[1/3]^36/(4*Pi*w1)^12];
Assert[g2^3/Δ == 0];
Assert[p[(2/5)*w1] - p[(4/5)*w1] == Sqrt[3]*5^(-1/12)*(2 + Sqrt[5])^(1/6)*Gamma[1/3]^6/(4*Pi*w1)^2];
With[{x = p[z], y = p'[z]},
Assert[p[I*Sqrt[3]*z] == 3^(-1)*(g3/x^2 - x)];
Assert[p'[I*Sqrt[3]*z] == I*3^(-3/2)*y*(1 + 8*g3/(y^2 + g3))];
Assert[p[I*z/Sqrt[3]] == -2^(-1)*x^(-1/2)*g3^(1/2)*Csc[ArcCsc[2*x^(3/2)*g3^(-1/2)]/3]];
Assert[z == x^(-1/2)*Hypergeometric2F1[1/6, 1/2, 7/6, g3/(4*x^3)]];
];
case[I*Infinity]; (* Degenerate cases *)
Assert[ζ[w1] == Pi^2/(12*w1)];
Assert[p[w1] == (Pi/w1)^2/6];
Assert[g2 == (Pi/w1)^4/12];
Assert[g3 == (Pi/w1)^6/216];
Assert[Δ == 0];
Assert[p[(2/5)*w1] - p[(4/5)*w1] == 5^(-1/2)*(Pi/w1)^2]
case[I*Sqrt[2]];
Assert[ζ[w1] == (Gamma[1/8]*Gamma[3/8])^2/(384*Pi*w1) + Pi/(2^(5/2)*w1)];
Assert[ζ[w3] == I*(Sqrt[2]*(Gamma[1/8]*Gamma[3/8])^2/(384*Pi*w1) - Pi/(4*w1))];
Assert[p[w1] == (3 + Sqrt[2])*(Gamma[1/8]*Gamma[3/8])^2/(2^(13/2)*3*Pi*w1^2)];
Assert[p[w2] == -(3 - Sqrt[2])*(Gamma[1/8]*Gamma[3/8])^2/(2^(13/2)*3*Pi*w1^2)];
Assert[p[w3] == -(Gamma[1/8]*Gamma[3/8])^2/(2^5*3*Pi*w1^2)];
Assert[g2 == 5*(Gamma[1/8]*Gamma[3/8])^4/(2^11*3*(Pi*w1^2)^2)];
Assert[g3 == 7*(Gamma[1/8]*Gamma[3/8])^6/(2^16*(3*Pi*w1^2)^3)];
Assert[Δ == (Gamma[1/8]*Gamma[3/8])^12/(2^33*(Pi*w1^2)^6)];
Assert[g2^3/Δ == 125/27];
case[I*Sqrt[3]];
Assert[ζ[w1] == Gamma[1/3]^6/(2^(20/3)*Pi^2*w1) + Pi/(4*Sqrt[3]*w1)];
Assert[ζ[w3] == I*(Sqrt[3]*Gamma[1/3]^6/(2^(20/3)*Pi^2*w1) - Pi/(4*w1))];
Assert[p[w1] == (2*Sqrt[3] + 1)*Gamma[1/3]^6/(2^(20/3)*(Pi*w1)^2)];
Assert[p[w2] == -Gamma[1/3]^6/(2^(17/3)*(Pi*w1)^2)];
Assert[p[w3] == -(2*Sqrt[3] - 1)*Gamma[1/3]^6/(2^(20/3)*(Pi*w1)^2)];
Assert[g2 == 15*Gamma[1/3]^12/(2^(34/3)*(Pi*w1)^4)];
Assert[g3 == 11*Gamma[1/3]^18/(2^17*(Pi*w1)^6)];
Assert[Δ == 27*Gamma[1/3]^36/(2^32*(Pi*w1)^12)];
Assert[g2^3/Δ == 125/4];
] & // Block[{$AssertFunction = Automatic}, #[]] &;
Half period and Quarter period values:
Module[{w1, w2, w3, w4, g2, g3, Δ, e1, e2, e3, η1, η2, a, b, c, ϕ, p, ζ, σ},
On[Assert];
w1 = 1;
w2 = I*Sqrt[Tan[RandomReal[WorkingPrecision -> 50]*Pi/2]];
w3 = w1 + w2;
w4 = w1 - w2;
{g2, g3} = WeierstrassInvariants[{w1, w2}];
Δ = g2^3 - 27*g3^2;
p[z_] := WeierstrassP[z, {g2, g3}];
ζ[z_] := WeierstrassZeta[z, {g2, g3}];
σ[z__] := Times @@ WeierstrassSigma[{z}, {g2, g3}];
(* Half period values *)
{e1, e2, e3} = p[{w1, w2, w3}];
{η1, η2} = ζ[{w1, w2}];
Assert[4*#^3 - g2*# - g3 == 0] & /@ {e1, e2, e3};
Assert[e1 + e2 + e3 == 0];
Assert[g2 == 2*(e1^2 + e2^2 + e3^2) == -4*(e1*e2 + e1*e3 + e2*e3)];
Assert[g3 == 4*e1*e2*e3 == (4/3)*(e1^3 + e2^3 + e3^3)];
Assert[Δ == 16*(e1 - e2)^2*(e1 - e3)^2*(e2 - e3)^2];
Assert[Δ == #^2*(4*#^2 - 3*g2)^2] & /@ (Subtract @@@ Permutations[{e1, e2, e3}, {2}]);
Assert[4*(e1 - e2)*(e1 - e3) == 12*e1^2 - g2];
Assert[4*(e2 - e3)*(e2 - e1) == 12*e2^2 - g2];
Assert[4*(e3 - e1)*(e3 - e2) == 12*e3^2 - g2];
Assert[p'[#] == 0] & /@ {w1, w2, w3};
a = Sqrt[g2/3];
ϕ = ArcSin[g3/a^3]/3;
Assert[e1 == a*Cos[Pi/6 - ϕ]];
Assert[e2 == -a*Cos[Pi/6 + ϕ]];
Assert[e3 == -a*Sin[ϕ]];
Assert[ζ[w3] == η1 + η2];
Assert[ζ[w4] == η1 - η2];
Assert[σ[w1] == Sqrt[2]*E^((1/2)*w1*η1)/(12*e1^2 - g2)^(1/4)];
Assert[σ[w2] == I*Sqrt[2]*E^((1/2)*w2*η2)/(12*e2^2 - g2)^(1/4)];
(* Quarter period values *)
a = Sqrt[e1 - e2];
b = Sqrt[e1 - e3];
c = Sqrt[e3 - e2];
Assert[p[(1/2)*w1] == e1 + a*b];
Assert[p[(1/2)*w2] == e2 - a*c];
Assert[p[(1/2)*w3] == e3 - I*b*c];
Assert[p[(1/2)*w4] == e3 + I*b*c];
Assert[p[(1/2)*w1 + w2] == e1 - a*b];
Assert[p[(1/2)*w2 + w1] == e2 + a*c];
Assert[p'[(1/2)*w1] == -2*a*b*(a + b)];
Assert[p'[(1/2)*w2] == -2*I*a*c*(a + c)];
Assert[p'[(1/2)*w3] == 2*b*c*(b + I*c)];
Assert[p'[(1/2)*w4] == 2*b*c*(b - I*c)];
Assert[p'[(1/2)*w1 + w2] == 2*a*b*(a - b)];
Assert[p'[(1/2)*w2 + w1] == 2*I*a*c*(a - c)];
Assert[ζ[(1/2)*w1] == (1/2)*(ζ[w1] + (a + b))];
Assert[ζ[(1/2)*w2] == (1/2)*(ζ[w2] - I*(a + c))];
Assert[σ[(1/2)*w1] == E^((1/8)*w1*η1)/(2^(1/4)*(a + b)^(1/4)*(a*b)^(3/8))];
Assert[σ[(1/2)*w2] == I*E^((1/8)*w2*η2)/(2^(1/4)*(a + c)^(1/4)*(a*c)^(3/8))];
(* Dedekind eta function representations *)
With[{τ = w2/w1, η = DedekindEta},
Assert[e1 == (Pi/w1)^2*((η[τ/2]^8 + 8*η[2*τ]^8)/η[τ]^4)/6];
Assert[e2 == -(Pi/w1)^2*((η[τ/2]^8 + 32*η[2*τ]^8)/η[τ]^4)/12];
Assert[e3 == -(Pi/w1)^2*((η[τ/2]^8 - 16*η[2*τ]^8)/η[τ]^4)/12];
];
] & // Block[{$AssertFunction = Automatic}, #[]] &;
One-third period values:
Module[{w1, w2, w3, w4, g2, g3, Δ, x, y, η1, η2, cbrtΔ, a0, a1, a2, a3, a4, p, ζ, σ},
w1 = 1;
w2 = I*Sqrt[Tan[RandomReal[WorkingPrecision -> 50]*Pi/2]];
w3 = w1 + w2;
w4 = w1 - w2;
{g2, g3} = WeierstrassInvariants[{w1, w2}];
Δ = g2^3 - 27*g3^2;
p[z_] := WeierstrassP[z, {g2, g3}];
ζ[z_] := WeierstrassZeta[z, {g2, g3}];
σ[z__] := Times @@ WeierstrassSigma[{z}, {g2, g3}];
{x, y} = Through[{p, p'}[(2/3)*{w1, w2, w3, w4}]];
Assert[#^4 - (1/2)*g2*#^2 - g3*# - (1/48)*g2^2 == 0] & /@ x;
Assert[#^8 - 8*g3*#^6 - (2/3)*Δ*#^4 - (1/27)*Δ^2 == 0] & /@ Join[y, -y];
Assert[g2 == Total[x^2]];
Assert[g3 == Total[x^3]/3 == Total[y^2]/8];
Assert[Δ == -I*3^(3/2)*(Times @@ y)];
cbrtΔ = CubeRoot[Δ];
a0 = (g2 - cbrtΔ)/3;
a1 = Sign[g3]*Sqrt[a0];
a2 = 2*If[a1 == 0, g2/Sqrt[3], g3/a1];
a3 = g2 - a0;
a4 = Sqrt[a2 - a0 - cbrtΔ];
Assert[x[[1]] == (a1 + Sqrt[a2 + a3])/2];
Assert[x[[2]] == (a1 - Sqrt[a2 + a3])/2];
Assert[x[[3]] == (-a1 - I*Sqrt[a2 - a3])/2];
Assert[x[[4]] == (-a1 + I*Sqrt[a2 - a3])/2];
Assert[y[[1]] == -cbrtΔ/(Sqrt[3]*Sqrt[a4 - a1])];
Assert[y[[2]] == -I*cbrtΔ/(Sqrt[3]*Sqrt[a4 + a1])];
{η1, η2} = ζ[{w1, w2}];
Assert[ζ[(2/3)*w1] == (2/3)*η1 + Sqrt[x[[1]]]/Sqrt[3]];
Assert[ζ[(2/3)*w2] == (2/3)*η2 - I*Sqrt[-x[[2]]]/Sqrt[3]];
Assert[σ[(2/3)*w1] == E^((2/9)*w1*η1)/(-y[[1]])^(1/3)];
Assert[σ[(2/3)*w2] == I*E^((2/9)*w2*η2)/(I*y[[2]])^(1/3)];
(* Dedekind eta function representations *)
With[{τ = w2/w1, η = DedekindEta},
Assert[x[[1]] == (Pi*(η[τ/3]^3 + 3*η[3*τ]^3)/(w1*η[τ]))^2/4];
Assert[x[[2]] == -(Pi*(η[τ/3]^3 + 9*η[3*τ]^3)/(w1*η[τ]))^2/12];
Assert[x[[3]] == -(Pi*(η[τ/3]^3 + I*3^(3/2)*η[3*τ]^3)/(w1*η[τ]))^2/12];
Assert[x[[4]] == -(Pi*(η[τ/3]^3 - I*3^(3/2)*η[3*τ]^3)/(w1*η[τ]))^2/12];
Assert[y[[1]] == -(Pi*η[τ]^3/(Sqrt[3]*w1*η[3*τ]))^3];
Assert[y[[2]] == -I*(Pi*η[τ]^3/(w1*η[τ/3]))^3];
Assert[y[[3]] == Sqrt[ I]*(Pi*η[τ]^3/(w1*η[(τ+1)/3]))^3];
Assert[y[[4]] == Sqrt[-I]*(Pi*η[τ]^3/(w1*η[(τ-1)/3]))^3];
];
] & // Block[{$AssertFunction = Automatic}, #[]] &;
One-fifth period values:
Module[{w1, w2, g2, g3, Δ, p, ζ, σ},
w1 = 1;
w2 = I*Sqrt[Tan[RandomReal[WorkingPrecision -> 50]*Pi/2]];
{g2, g3} = WeierstrassInvariants[{w1, w2}];
Δ = g2^3 - 27*g3^2;
p[z_] := WeierstrassP[z, {g2, g3}];
ζ[z_] := WeierstrassZeta[z, {g2, g3}];
σ[z__] := Times @@ WeierstrassSigma[{z}, {g2, g3}];
Module[{x, y, sqrtx, t, a},
{x, y} = p[(2/5)*#] + {-1, 1}*p[(4/5)*#];
t = Sign[#];
sqrtx = Sqrt[t^2*x]/t;
t = Δ/x^6;
a = 3*y/x + (11 + t)/2;
Assert[x^12 - (12/5)*g2*x^10 + 2*Δ*x^6 + (1/5)*Δ^2 == 0];
Assert[y == x*Sqrt[5^3 + 22*t + t^2]/6];
Assert[p[(2/5)*#] == (y + x)/2 == x*(2/a + 17 + t)/12];
Assert[p[(4/5)*#] == (y - x)/2 == x*(2/a + 5 + t)/12];
Assert[p'[(2/5)*#] == -sqrtx^3*a^( 1/2)];
Assert[p'[(4/5)*#] == -sqrtx^3*a^(-1/2)];
Assert[ζ[(2/5)*#] == (2/5)*ζ[#] + sqrtx*(1 + 3*a)/(10*Sqrt[a])];
Assert[ζ[(4/5)*#] == (4/5)*ζ[#] - sqrtx*(3 - 1*a)/(10*Sqrt[a])];
Assert[σ[(2/5)*#] == E^((2/25)*#*ζ[#])*a^(-1/10)/sqrtx];
Assert[σ[(4/5)*#] == E^((8/25)*#*ζ[#])*a^( 1/10)/sqrtx];
(* https://mathworld.wolfram.com/AbelsImpossibilityTheorem.html *)
] & /@ {w1, w2};
(* Dedekind eta function representations *)
With[{τ = w2/w1, η = DedekindEta},
Assert[p[(2/5)*w1] - p[(4/5)*w1] == (Pi/w1)^2*η[τ]^5/(Sqrt[5]*η[5*τ])];
Assert[p[(2/5)*w2] - p[(4/5)*w2] == -(Pi/w1)^2*η[τ]^5/η[τ/5]];
];
(* Hypergeometric series representations *)
With[{t = g3*(3/g2)^(3/2), f = (Times @@ Hypergeometric2F1[1/6, 5/6, {4/5, 6/5}, #]) &},
Assert[p[(2/5)*w1] - p[(4/5)*w1] == 2*Sqrt[(3/5)*g2]/f[(1 - t)/2]];
Assert[p[(2/5)*w2] - p[(4/5)*w2] == -2*Sqrt[(3/5)*g2]/f[(1 + t)/2]];
];
] & // Block[{$AssertFunction = Automatic}, #[]] &;
Sigma function notation:
Module[{z, a, b, c0, c1, c2, w1, w2, g2, g3, d, p, ζ, σ},
w1 = 1;
w2 = I*Sqrt[Tan[RandomReal[WorkingPrecision -> 50]*Pi/2]];
{g2, g3} = WeierstrassInvariants[{w1, w2}];
z = w1*(2*RandomReal[WorkingPrecision -> 50] - 1);
a = w1*(2*RandomReal[WorkingPrecision -> 50] - 1);
b = w1*(2*RandomReal[WorkingPrecision -> 50] - 1);
c0 = a - b;
p[z_] := WeierstrassP[z, {g2, g3}];
ζ[z_] := WeierstrassZeta[z, {g2, g3}];
σ[z__] := Times @@ WeierstrassSigma[{z}, {g2, g3}];
With[{wp = p[c0], pd = p'[c0]},
c1 = InverseWeierstrassP[{(-wp + Sqrt[g2 - 3*wp^2])/2, pd}, {g2, g3}];
c2 = -c0 - c1;
];
Assert[ζ[z + a] - ζ[z - a] == 2*ζ[a] - σ[2*a, z, z]/σ[z + a, z - a, a, a]];
d = ζ[a - b];
Assert[ζ[z + a] - ζ[z + b] == d - σ[a - b, z + a + c1, z + b - c1]/σ[z + a, z + b, c1, c2]];
Assert[ζ[z - a] - ζ[z - b] == -d + σ[a - b, z - a - c1, z - b + c1]/σ[z - a, z - b, c1, c2]];
Assert[ζ[z + a] - ζ[z + b] == d - (σ[2*(z + b), z + a, z + a]/σ[z + b, z + b] + σ[2*(z + a), z + b, z + b]/σ[z + a, z + a])/(2*σ[a - b, 2*z + a + b])];
Assert[ζ[z - a] - ζ[z - b] == -d + (σ[2*(z - b), z - a, z - a]/σ[z - b, z - b] + σ[2*(z - a), z - b, z - b]/σ[z - a, z - a])/(2*σ[a - b, 2*z - a - b])];
d = ζ[a - b] + (3*p[a - b]^2 - g2/4)/p'[a - b];
Assert[ζ[z + a] - ζ[z + b] == d + σ[z - a + 2*b, z - b + 2*a]/σ[z + a, z + b, 2*(a - b)]];
Assert[ζ[z - a] - ζ[z - b] == -d - σ[z + a - 2*b, z + b - 2*a]/σ[z - a, z - b, 2*(a - b)]];
] & // Block[{$AssertFunction = Automatic}, #[]] &;
Relations to Jacobi elliptic functions:
Module[{z, p, s, c, d, n, ϕ, g2, g3, m, w1, w2},
m = RandomReal[WorkingPrecision -> 50];
w1 = EllipticK[m];
w2 = I*EllipticK[1 - m];
z = w1*RandomReal[WorkingPrecision -> 50];
With[{t = m*(1 - m)},
g2 = (4/3)*(1 - t);
g3 = (4/27)*(1 - 2*m)*(2 + t);
];
Assert[WeierstrassInvariants[{w1, w2}] == {g2, g3}];
p = WeierstrassP[z/2, {g2, g3}];
s = WeierstrassPPrime[z/2, {g2, g3}];
c = 1 - m - (p - (2 - m)/3)^2;
d = m*(m - 1) - (p + (1 - 2*m)/3)^2;
n = m - (p + (1 + m)/3)^2;
ϕ = -2*ArcTan[2*(p + (1 - 2*m)/3)/s];
Assert[JacobiSN[z, m] == s/n];
Assert[JacobiCN[z, m] == c/n];
Assert[JacobiDN[z, m] == d/n];
Assert[PossibleZeroQ@Mod[JacobiAmplitude[z, m] - ϕ, 2*Pi, -Pi]];
Assert[PossibleZeroQ@Mod[EllipticF[ϕ, m] - z, 2*w1, -w1]];
With[{ζ = WeierstrassZeta[#, {g2, g3}] &},
Assert[JacobiZeta[ϕ, m] == ζ[z + w2] - ζ[w2] - z*ζ[w1]/w1];
Assert[EllipticE[m] == ζ[w1] + w1*(2 - m)/3];
Assert[I*EllipticE[1 - m] == -ζ[w2] + w2*(1 + m)/3];
];
Assert[WeierstrassP[z, {g2, g3}] == Csc[ϕ]^2 - (1 + m)/3 == Cot[ϕ]^2 + (2 - m)/3];
Assert[WeierstrassPPrime[z, {g2, g3}] == -2*Csc[ϕ]^2*Cot[ϕ]*Sqrt[1 - m*Sin[ϕ]^2]];
] & // Block[{$AssertFunction = Automatic}, #[]] &;
(* https://resources.wolframcloud.com/PacletRepository/resources/JanM/Dixon/ *)
<< "JanM`Dixon`";
Hold[{f, u, v, α, s, c, x, y, z, b, γ, w1, w2, λ, λ0, λ1, λ2, κ, κ0, κ1, κ2, ϕ, pr, sqrt},
pr = 50;
α = -RandomReal[WorkingPrecision -> pr];
b = (9*(1 - α + α^2))^(1/3);
γ = CubeRoot[1 + α^3];
sqrt[z_] := RandomChoice[{1, -1}]*Sqrt[z];
w1 = Exp[2*sqrt[-1]*Pi/3];
w2 = Conjugate[w1];
λ0 = Gamma[1/3]^3/(2*Sqrt[3]*Pi);
κ0 = 4*Pi^2/(3*Gamma[1/3]^3);
Assert[N[DixonF[λ0, 0] == κ0, pr]];
x = λ0*Hypergeometric2F1[1/3, 1/3, 2/3, -α^3];
y = κ0*α*Hypergeometric2F1[2/3, 2/3, 4/3, -α^3];
λ = Quiet@Re[x + y];
λ1 = w1*x + w2*y;
λ2 = w2*x + w1*y;
x = κ0*Hypergeometric2F1[-1/3, 2/3, 1/3, -α^3];
y = λ0*α^2*Hypergeometric2F1[1/3, 4/3, 5/3, -α^3]/2;
κ = Quiet@Re[x + y];
κ1 = α + w2*x + w1*y;
κ2 = α + w1*x + w2*y;
If[α < 0 && !VectorQ[{λ, κ}, NumericQ], With[{b = 1 + α^(-3)},
{λ, κ} = 2*Pi*3^(-3/2)*{
-Hypergeometric2F1[1/3, 2/3, 1, b]/α,
Hypergeometric2F1[2/3, 4/3, 1, b]/α^2
};
]];
κ += α;
{u, v} = RandomReal[{0, λ}, 2, WorkingPrecision -> pr];
x = DixonSM[0, α];
y = DixonCM[0, α];
Assert[x == 0];
Assert[y == 1];
x = DixonSM[λ, α];
y = DixonCM[λ, α];
Assert[x == 1];
Assert[y == 0];
x = DixonSM[λ/2, α];
y = DixonCM[λ/2, α];
Assert[x == y];
Assert[2*x^3 == 1 + 3*α*x^2];
x = DixonSM[λ/3, α];
y = DixonCM[λ/3, α];
Assert[x^2*y + x - y^2 == 0];
Assert[y^2*x + y - x^2 == b*x*y];
Assert[x^3 + 1 == b*x];
Assert[y^3 + 1 == b*y^2];
x = DixonSM[λ/4, α];
y = DixonCM[λ/4, α];
Assert[x + x^3 == y^3*(1 - x)];
Assert[DixonF[λ, α] == κ];
If[α != -1,
Assert[DixonF[λ1, α] == κ1];
Assert[DixonF[λ2, α] == κ2];
];
s = DixonSM[u, α];
c = DixonCM[u, α];
Assert[s^3 + c^3 == 1 + 3*α*s*c];
Assert[DixonSM[λ - u, α] == c];
Assert[DixonCM[λ - u, α] == s];
Assert[DixonSM[u + λ, α] == DixonCM[-u, α] == 1/c];
Assert[DixonCM[u + λ, α] == DixonSM[-u, α] == -s/c];
Assert[DixonSM[u - λ, α] == DixonCM[-u - λ, α] == -c/s];
Assert[DixonCM[u - λ, α] == DixonSM[-u - λ, α] == 1/s];
Assert[DixonSM[2*u, α] == s*(1 + c^3)/(c*(1 + s^3))];
Assert[DixonCM[2*u, α] == (c^3 - s^3)/(c*(1 + s^3))];
Assert[DixonSM[3*u, α] == s*c*(1 + s^3 + c^3 + s^6 + c^6 - s^3*c^3)/(c^3 - s^6 + 3*s^3*c^3 + c^6*s^3)];
Assert[DixonCM[3*u, α] == -(s^3 - c^6 + 3*s^3*c^3 + s^6*c^3)/(c^3 - s^6 + 3*s^3*c^3 + c^6*s^3)];
With[{v = λ1 - λ2}, If[NumericQ[v],
Assert[DixonSM[u + v, α] == w2*s];
Assert[DixonCM[u + v, α] == w1*c];
]];
Assert[Derivative[1, 0][DixonSM][u, α] == c^2 - α*s];
Assert[Derivative[1, 0][DixonCM][u, α] == -s^2 + α*c];
f[u_, α_] := DixonSM[u, α];
x = f[u, α];
y = Derivative[1, 0][f][u, α];
Assert[y^3 - 3*α*x*y^2 - x^6 + (2 + 4*α^3)*x^3 - 1 == 0];
If[α < 0 && x > 0, Assert[y*Hypergeometric2F1[1/3, 2/3, 1/2, (1 - x^3)^2/(4*(α*x)^3)] == -α*x]];
f[u_, α_] := DixonCM[u, α];
x = f[u, α];
y = Derivative[1, 0][f][u, α];
Assert[y^3 + 3*α*x*y^2 + x^6 - (2 + 4*α^3)*x^3 + 1 == 0];
If[α < 0 && x > 0, Assert[y*Hypergeometric2F1[1/3, 2/3, 1/2, (1 - x^3)^2/(4*(α*x)^3)] == α*x]];
f[u_, α_] := DixonSM[u, α] + DixonCM[u, α];
x = f[u, α];
y = Derivative[1, 0][f][u, α];
Assert[3*y^2 + (x + α)*(x^3 - 3*α*x^2 - 4) == 0];
f[u_, α_] := DixonSM[u, α]*DixonCM[u, α];
x = f[u, α];
y = Derivative[1, 0][f][u, α];
Assert[y^2 + 4*x^3 == (1 + 3*α*x)^2];
f[u_, α_] := If[PossibleZeroQ[1 + α], -1/3, 1/(DixonSM[u, α] + DixonCM[u, α] + α)];
x = f[u, α];
y = Derivative[1, 0][f][u, α];
Assert[3*y^2 == 4*(1 + α^3)*x^3 - (1 - 3*α*x)^2];
If[α < 0,
f[u_, α_] := With[{s = DixonSM[u, α], c = DixonCM[u, α]}, ArcTan[(1 - c - 2*α*s)/(Sqrt[3]*(1 + c))]];
x = f[u, α];
y = Derivative[1, 0][f][u, α];
Assert[y*Hypergeometric2F1[1/3, 2/3, 1/2, (1 + α^(-3))*Sin[x]^2] == -Sqrt[3]*α/2];
];
Clear[f];
If[Context[CarlsonRF] === "System`",
f[u_, v_] :=
Block[{x, y, z, b = Abs[α]^(3/2), ϕ},
ϕ = 2*I*Pi*{1, -1, 0};
ϕ = Which[
α > 0, (ArcCsch[b] + ϕ)/3,
α < 0, (ArcSech[b] + ϕ)/3
];
b = v*α;
{x, y, z} = Which[
b > 0, 1 + Csch[ϕ]^2/4,
b < 0, 1 - Sech[ϕ]^2/4,
True, Table[1, 3]
];
Assert[y == Conjugate[x] && z >= 3/4];
Assert[u == Re[CarlsonRF[x, y, z]]];
Assert[u == Sqrt[2]*CarlsonRF[Re[x] + Abs[x], z + Abs[x] + Abs[z - x], z + Abs[x] - Abs[z - x]]];
]
];
If[α != -1, With[{u = HypergeometricPFQ[{1/2, 1/2, 1}, {5/6, 7/6}, -α^3], s = sqrt[3*α]},
Assert[DixonSM[s*u, α] == s];
Assert[DixonCM[s*u, α] == 1];
Assert[DixonF[s*u, α] == (3*α)/2 + s*(3/5)*α^2*HypergeometricPFQ[{1/2, 1, 3/2}, {7/6, 11/6}, -α^3]];
Assert[DixonF[s*u + λ, α] == κ - (3*α)/2 + s*(3/5)*α^2*HypergeometricPFQ[{1/2, 1, 3/2}, {7/6, 11/6}, -α^3]];
Assert[PossibleZeroQ[α] || DixonF[s*u - λ, α] == -κ + (3*α)/2 + s^(-1)*HypergeometricPFQ[{-1/2, 1/2, 1}, {1/6, 5/6}, -α^3]];
If[α > -1, With[{v = u*Sqrt[1 + α^3]},
With[{b = SetPrecision[(3*α)^3/4, Infinity]},
Assert[u == (1/2)*NIntegrate[(x^3 + b*(x - 1)^2)^(-1/2), {x, 1, Infinity}, WorkingPrecision -> pr]]; (* hard case at x = 3 *)
Assert[u == NIntegrate[(1 + b*x^2*(1 - x^2)^2)^(-1/2), {x, 0, 1}, WorkingPrecision -> pr]]; (* hard case at x = 3^(-1/2) *)
];
If[!PossibleZeroQ[α], With[{b = SetPrecision[1 + α^(-3), Infinity], ϕ = SetPrecision[ArcTan[α^(3/2)], Infinity]},
Assert[v == NIntegrate[(4*x^3 - (1 - 3*x)^2/b)^(-1/2), {x, 1, Infinity}, WorkingPrecision -> pr]];
Assert[v == NIntegrate[(1 - x^2*(3 - x^2)^2/(4*b))^(-1/2), {x, 0, 1}, WorkingPrecision -> pr]];
Assert[u == (2/3)*α^(-3/2)*N[NIntegrate[Hypergeometric2F1[1/3, 2/3, 1/2, b*Sin[x]^2], {x, 0, ϕ},
WorkingPrecision -> pr, PrecisionGoal -> pr/2
], pr/2]];
]];
f[v, -1];
]];
]];
If[α > -1, With[{u = HypergeometricPFQ[{1/2, 1/2, 1}, {5/6, 7/6}, α^3/(1 + α^3)]/Sqrt[1 + α^3], s = sqrt[α]},
Assert[DixonSM[s*u, α] == s*E^((1/3)*ArcSinh[s^3])];
Assert[DixonCM[s*u, α] == E^((2/3)*ArcSinh[s^3])];
Assert[Derivative[1, 0][DixonSM][s*u, α] == Sqrt[1 + α^3]*E^((1/3)*ArcSinh[s^3])];
Assert[Derivative[1, 0][DixonCM][s*u, α] == 0];
If[!PossibleZeroQ[α], With[{b = SetPrecision[α^(-3), Infinity], ϕ = SetPrecision[ArcSinh[α^(3/2)], Infinity]},
Assert[u == NIntegrate[(4*x^3 + (1 - 3*x)^2/b)^(-1/2), {x, 1, Infinity}, WorkingPrecision -> pr]];
Assert[u == NIntegrate[(1 + x^2*(3 - x^2)^2/(4*b))^(-1/2), {x, 0, 1}, WorkingPrecision -> pr]];
Assert[u == (2/3)*α^(-3/2)*N[NIntegrate[Hypergeometric2F1[1/3, 2/3, 1/2, b*Sinh[x]^2], {x, 0, ϕ},
WorkingPrecision -> pr, PrecisionGoal -> pr/2
], pr/2]];
]];
f[u, 1];
]];
If[α <= 0, With[{b = SetPrecision[α^3, Infinity]},
Assert[λ == NIntegrate[(1 - b*x^3)^(-1/3)*(1 + x^3)^(-2/3), {x, 0, Infinity}, WorkingPrecision -> pr]];
Assert[λ == NIntegrate[x*(x^3 - b)^(-1/3)*(1 + x^3)^(-2/3), {x, 0, Infinity}, WorkingPrecision -> pr]];
]];
f[u_, α_] := Through[{DixonSM, DixonCM}[u, α]]; (* ComapApply *)
If[!PossibleZeroQ[γ],
Assert[f[w1*u, w2*α] == {w1*s, c}];
Assert[f[u*(1 + α)/(w2 - w1), (2 - α)/(1 + α)] == -{s + c - 1, s + w2*c - w1}/(s + w1*c - w2)];
Assert[f[3*u*γ/(w2 - w1), -α/γ] == -{3*γ*s*c, s^3 + w2*c^3 - w1}/(s^3 + w1*c^3 - w2)];
Assert[f[u*γ/(w2 - w1), -α/γ]^3 == -{α*s - c + 1, α*s - w2*c + w1}/(α*s - w1*c + w2)];
Assert[f[b*u, (α - 2)/b] == {b*s*c, -(s - c^2 + c*s^2)}/(c - s^2 + s*c^2)];
Assert[f[b*u/3, (α - 2)/b]^3 == {α*s - c + 1, α*c - s + 1}/(s + c + α)];
Assert[f[(γ - α)*u, (2*γ + α)/(γ - α)] == {s^3 + (γ - α)*s*c, c^3 + (γ - α)*s*c}/(1 - (γ - α)*s*c)];
];
Block[{u, v},
{u, v} = RandomReal[{0, λ0}, 2, WorkingPrecision -> pr];
With[{s1 = DixonSM[u], c1 = DixonCM[u], s2 = DixonSM[v], c2 = DixonCM[v]},
Assert[DixonSM[u + w1*v] == (s1*c2*(c2 + s1*c1*s2^2) + w1*s2*c1*(c1 + s2*c2*s1^2))/(1 - s1^3*s2^3)];
Assert[DixonCM[u + w1*v] == (c1*(c2 + s1*c1*s2^2) + w1*s1*s2*(s2*c1^2 - s1*c2^2))/(1 - s1^3*s2^3)];
];
];
] /.
HoldPattern[_[vars:{___Symbol}, expr_]] :>
Block[{$AssertFunction = Automatic},
With[{temp = Unique[Unevaluated[vars], Temporary]},
WithCleanup[
Unevaluated[expr] /. Dispatch[Thread@Hold[vars, temp] /. Hold[lhs_, rhs_] :> (HoldPattern[lhs] -> rhs)],
Remove @@ Unevaluated[temp]
] /; ListQ[temp]
]
];
Theta functions:
Module[{u, q, a, b},
u = RandomReal[WorkingPrecision -> 50];
q = RandomReal[WorkingPrecision -> 50];
a = ((EllipticTheta[4, q]/EllipticTheta[4, Pi/3, q])^2 + 2*EllipticTheta[4, Pi/3, q]/EllipticTheta[4, q])/3;
b = EllipticTheta[2, q]*EllipticTheta[3, q]*EllipticTheta[4, q]/(2*Sqrt[3]*EllipticTheta[1, Pi/3, q]);
Assert[EllipticTheta[1, u, q^3]^3 == b*(a*EllipticTheta[1, u, q] - EllipticTheta[1, u + Pi/3, q] + EllipticTheta[1, u + 2*Pi/3, q])];
Assert[EllipticTheta[2, u, q^3]^3 == b*(a*EllipticTheta[2, u, q] - EllipticTheta[2, u + Pi/3, q] + EllipticTheta[2, u + 2*Pi/3, q])];
Assert[EllipticTheta[3, u, q^3]^3 == b*(a*EllipticTheta[3, u, q] + EllipticTheta[3, u + Pi/3, q] + EllipticTheta[3, u + 2*Pi/3, q])];
Assert[EllipticTheta[4, u, q^3]^3 == b*(a*EllipticTheta[4, u, q] + EllipticTheta[4, u + Pi/3, q] + EllipticTheta[4, u + 2*Pi/3, q])];
Assert[EllipticTheta[1, u, q^3] == EllipticTheta[1, u/3, q]*EllipticTheta[1, (u + Pi)/3, q]*EllipticTheta[1, (u + 2*Pi)/3, q]/(3*b)];
Assert[EllipticTheta[2, u, q^3] == -EllipticTheta[2, u/3, q]*EllipticTheta[2, (u + Pi)/3, q]*EllipticTheta[2, (u + 2*Pi)/3, q]/(3*b)];
Assert[EllipticTheta[3, u, q^3] == EllipticTheta[3, u/3, q]*EllipticTheta[3, (u + Pi)/3, q]*EllipticTheta[3, (u + 2*Pi)/3, q]/(3*b)];
Assert[EllipticTheta[4, u, q^3] == EllipticTheta[4, u/3, q]*EllipticTheta[4, (u + Pi)/3, q]*EllipticTheta[4, (u + 2*Pi)/3, q]/(3*b)];
Assert[EllipticTheta[1, u, q^9] == -(EllipticTheta[1, u/3, q] - EllipticTheta[1, (u + Pi)/3, q] + EllipticTheta[1, (u + 2*Pi)/3, q])/3];
Assert[EllipticTheta[2, u, q^9] == (EllipticTheta[2, u/3, q] - EllipticTheta[2, (u + Pi)/3, q] + EllipticTheta[2, (u + 2*Pi)/3, q])/3];
Assert[EllipticTheta[3, u, q^9] == (EllipticTheta[3, u/3, q] + EllipticTheta[3, (u + Pi)/3, q] + EllipticTheta[3, (u + 2*Pi)/3, q])/3];
Assert[EllipticTheta[4, u, q^9] == (EllipticTheta[4, u/3, q] + EllipticTheta[4, (u + Pi)/3, q] + EllipticTheta[4, (u + 2*Pi)/3, q])/3];
With[{s = EllipticTheta[1, u, q], m = EllipticTheta[1, u + Pi/3, q], c = EllipticTheta[1, u + 2*Pi/3, q]},
Assert[EllipticTheta[1, u+Pi/9, q]^3 == ( EllipticTheta[1, Pi/9, q]^3*c*m^2 + EllipticTheta[1, 2*Pi/9, q]^3*s*c^2 + EllipticTheta[1, 4*Pi/9, q]^3*m*s^2)/EllipticTheta[1, Pi/3, q]^3]
Assert[EllipticTheta[1, u-Pi/9, q]^3 == (-EllipticTheta[1, Pi/9, q]^3*m*c^2 + EllipticTheta[1, 2*Pi/9, q]^3*s*m^2 - EllipticTheta[1, 4*Pi/9, q]^3*c*s^2)/EllipticTheta[1, Pi/3, q]^3];
];
] & // Block[{$AssertFunction = Automatic}, #[]] &;
(* Addition *)
D[f[x] + g[x], x] == f'[x] + g'[x]
D[f[x] + g[x], {x, 2}] == f''[x] + g''[x]
(* Subtraction *)
D[f[x] - g[x], x] == f'[x] - g'[x]
D[f[x] - g[x], {x, 2}] == f''[x] - g''[x]
(* Multiplication by constant *)
D[a * f[x], x] == a * f'[x]
D[a * f[x], {x, 2}] == a * f''[x]
(* Dot product *)
D[f[x] . g[x], x] == f[x] . g'[x] + f'[x] . g[x]
D[f[x] . g[x], {x, 2}] == f[x] . g''[x] + 2 * f'[x] . g'[x] + f''[x] . g[x]
(* Hadamard product *)
D[f[x] * g[x], x] == f[x] * g'[x] + f'[x] * g[x]
D[f[x] * g[x], {x, 2}] == f[x] * g''[x] + 2 * f'[x] * g'[x] + f''[x] * g[x]
(* Inverse *)
D[Inverse[f[x]], x] == -Inverse[f[x]] . f'[x] . Inverse[f[x]]
D[Inverse[f[x]], {x, 2}] == Inverse[f[x]] . (2 * f'[x] . Inverse[f[x]] . f'[x] - f''[x]) . Inverse[f[x]]
(* Transpose *)
D[Transpose[f[x]], x] == Transpose[f'[x]]
D[Transpose[f[x]], {x, 2}] == Transpose[f''[x]]
(* Trace *)
D[Tr[f[x]], x] == Tr[f'[x]]
D[Tr[f[x]], {x, 2}] == Tr[f''[x]]
D[Tr[MatrixPower[f[x], n]], x] == n * Tr[MatrixPower[f[x], n - 1] . f'[x]]
D[Tr[MatrixExp[f[x]]], x] == Tr[MatrixExp[f[x]] . f'[x]]
D[Tr[MatrixLog[f[x]]], x] == Tr[Inverse[f[x]] . f'[x]]
D[Tr[MatrixFunction[p, f[x]]], x] == Tr[MatrixFunction[p', f[x]] . f'[x]]
(* Determinant *)
D[Det[f[x]], x] == Det[f[x]] * Tr[Inverse[f[x]] . f'[x]]
D[Det[f[x]], {x, 2}] == Det[f[x]] * (Tr[Inverse[f[x]] . f'[x]]^2 + Tr[Inverse[f[x]] . (f''[x] - f'[x] . Inverse[f[x]] . f'[x])])
D[Det[MatrixPower[f[x], n]], x] == n * Det[MatrixPower[f[x], n]] * Tr[Inverse[f[x]] . f'[x]]
D[Det[MatrixExp[f[x]]], x] == Det[MatrixExp[f[x]]] * Tr[f'[x]]
D[Det[MatrixLog[f[x]]], x] == Det[MatrixLog[f[x]]] * Tr[f'[x] . Inverse[f[x]] . Inverse[MatrixLog[f[x]]]]
D[Det[MatrixFunction[p, f[x]]], x] == Det[MatrixFunction[p, f[x]]] * Tr[f'[x] . MatrixFunction[p', f[x]] . Inverse[MatrixFunction[p, f[x]]]]
(* Logarithm of determinant *)
D[Log[Det[f[x]]], x] == Tr[Inverse[f[x]] . f'[x]]
D[Log[Det[f[x]]], {x, 2}] == Tr[Inverse[f[x]] . (f''[x] - f'[x] . Inverse[f[x]] . f'[x])]
D[Log[Det[MatrixPower[f[x], n]]], x] == n * Tr[Inverse[f[x]] . f'[x]]
D[Log[Det[MatrixExp[f[x]]]], x] == Tr[f'[x]]
D[Log[Det[MatrixLog[f[x]]]], x] == Tr[f'[x] . Inverse[f[x]] . Inverse[MatrixLog[f[x]]]]
D[Log[Det[MatrixFunction[p, f[x]]]], x] == Tr[f'[x] . MatrixFunction[p', f[x]] . Inverse[MatrixFunction[p, f[x]]]]
{
my(
f=default(format),
p=default(realprecision),
bp=default(realbitprecision),
w,w1,w2,w3,g2,g3,z1,z2,z3,z4,p1,p2,p3,p4,P
);
default(realbitprecision,bp+64);
default(format,f);
setrand(getwalltime());
f=strprintf("%%.%dg\n",p);
w1=tan(random(1.)*Pi/2);
w2=I*tan(random(1.)*Pi/2);
w3=-w1-w2;
w=2*[w1,w2];
g2=elleisnum(w,4)/12;
g3=-elleisnum(w,6)/216;
P=((z,n)->my(a,b,x,y,t);[x,y]=ellwp(w,z,1);t=vector(n);a='x;t[1]=x;for(i=2,n,t[i]=if(i%2,a=(4*'x^3-g2*'x-g3)*deriv(b,'x)+(6*'x^2-g2/2)*b;subst(a,'x,x),b=deriv(a,'x);y*subst(b,'x,x)));return(t));
z1=random(1.)*w1;p1=P(z1,6);
z2=random(1.)*w1;p2=P(z2,4);
z3=random(1.)*w1;p3=P(z3,4);
z4=random(1.)*w1;p4=P(z4,4);
printf(f, matdet([
1,p1[1];
1,p2[1]
]));
printf(f, ellsigma(w,z1-z2)*ellsigma(w,z1+z2)/(ellsigma(w,z1)*ellsigma(w,z2))^2);
printf(f, matdet([
1,p1[1],p1[2];
1,p2[1],p2[2];
1,p3[1],p3[2]
]));
printf(f, -2!*ellsigma(w,z1-z2)*ellsigma(w,z1-z3)*ellsigma(w,z2-z3)*ellsigma(w,z1+z2+z3)/(ellsigma(w,z1)*ellsigma(w,z2)*ellsigma(w,z3))^3);
printf(f, matdet([
1,p1[1],p1[2],p1[3];
1,p2[1],p2[2],p2[3];
1,p3[1],p3[2],p3[3];
1,p4[1],p4[2],p4[3]
]));
printf(f, -2!*3!*ellsigma(w,z1-z2)*ellsigma(w,z1-z3)*ellsigma(w,z1-z4)*ellsigma(w,z2-z3)*ellsigma(w,z2-z4)*ellsigma(w,z3-z4)*ellsigma(w,z1+z2+z3+z4)/(ellsigma(w,z1)*ellsigma(w,z2)*ellsigma(w,z3)*ellsigma(w,z4))^4);
printf(f, matdet([
1,p1[1];
0,p1[2]
]));
printf(f, -ellsigma(w,2*z1)/ellsigma(w,z1)^4);
printf(f, matdet([
1,p1[1],p1[2];
0,p1[2],p1[3];
0,p1[3],p1[4]
]));
printf(f, 2!^2*ellsigma(w,3*z1)/ellsigma(w,z1)^9);
printf(f, matdet([
1,p1[1],p1[2],p1[3];
0,p1[2],p1[3],p1[4];
0,p1[3],p1[4],p1[5];
0,p1[4],p1[5],p1[6]
]));
printf(f, -(2!*3!)^2*ellsigma(w,4*z1)/ellsigma(w,z1)^16);
printf(f, matdet([
1,p1[1],p1[2];
1,p2[1],p2[2];
1,p3[1],p3[2]
])/matdet([
1,p1[1];
1,p2[1]
]));
printf(f, -2!*ellsigma(w,z1-z3)*ellsigma(w,z2-z3)*ellsigma(w,z1+z2+z3)/(ellsigma(w,z1)*ellsigma(w,z2)*ellsigma(w,z1+z2)*ellsigma(w,z3)^3));
printf(f, matdet([
1,p1[1],p1[2],p1[3];
1,p2[1],p2[2],p2[3];
1,p3[1],p3[2],p3[3];
1,p4[1],p4[2],p4[3]
])/matdet([
1,p1[1],p1[2];
1,p2[1],p2[2];
1,p3[1],p3[2]
]));
printf(f, 3!*ellsigma(w,z1-z4)*ellsigma(w,z2-z4)*ellsigma(w,z3-z4)*ellsigma(w,z1+z2+z3+z4)/(ellsigma(w,z1)*ellsigma(w,z2)*ellsigma(w,z3)*ellsigma(w,z1+z2+z3)*ellsigma(w,z4)^4));
printf(f, matdet([
1,p1[1],p1[2];
0,p1[2],p1[3];
1,p2[1],p2[2]
])/matdet([
1,p1[1];
0,p1[2]
]));
printf(f, -2!*ellsigma(w,z1-z2)^2*ellsigma(w,2*z1+z2)/(ellsigma(w,z1)^2*ellsigma(w,2*z1)*ellsigma(w,z2)^3));
printf(f, matdet([
1,p1[1],p1[2],p1[3];
0,p1[2],p1[3],p1[4];
0,p1[3],p1[4],p1[5];
1,p2[1],p2[2],p2[3]
])/matdet([
1,p1[1],p1[2];
0,p1[2],p1[3];
0,p1[3],p1[4]
]));
printf(f, 3!*ellsigma(w,z1-z2)^3*ellsigma(w,3*z1+z2)/(ellsigma(w,z1)^3*ellsigma(w,3*z1)*ellsigma(w,z2)^4));
printf(f, (1/2)*matdet([
1,p1[2];
1,p2[2]
])/matdet([
1,p1[1];
1,p2[1]
]));
printf(f, ellzeta(w,z1+z2)-ellzeta(w,z1)-ellzeta(w,z2));
printf(f, (1/3)*matdet([
1,p1[1],p1[3];
1,p2[1],p2[3];
1,p3[1],p3[3]
])/matdet([
1,p1[1],p1[2];
1,p2[1],p2[2];
1,p3[1],p3[2]
]));
printf(f, ellzeta(w,z1+z2+z3)-ellzeta(w,z1)-ellzeta(w,z2)-ellzeta(w,z3));
printf(f, (1/4)*matdet([
1,p1[1],p1[2],p1[4];
1,p2[1],p2[2],p2[4];
1,p3[1],p3[2],p3[4];
1,p4[1],p4[2],p4[4]
])/matdet([
1,p1[1],p1[2],p1[3];
1,p2[1],p2[2],p2[3];
1,p3[1],p3[2],p3[3];
1,p4[1],p4[2],p4[3]
]));
printf(f, ellzeta(w,z1+z2+z3+z4)-ellzeta(w,z1)-ellzeta(w,z2)-ellzeta(w,z3)-ellzeta(w,z4));
default(realbitprecision,bp);
}
BeginPackage["CubicTheta`"];
Unprotect[CubicTheta, CubicThetaA, CubicThetaB, CubicThetaC, CubicThetaAPrime, CubicThetaBPrime, CubicThetaCPrime];
ClearAll[CubicTheta, CubicThetaA, CubicThetaB, CubicThetaC, CubicThetaAPrime, CubicThetaBPrime, CubicThetaCPrime];
Begin["`Private`"];
CubicTheta[u_, v_, q_] /;
(VectorQ[{u, v, q}, NumericQ] && Abs[q] < 1 && Precision[{u, v, q}] < Infinity) :=
Module[{p = q^3, t, a = u + v, b = u - v},
t = EllipticTheta[3, a, p]*EllipticTheta[3, b, q];
If[!PossibleZeroQ[p], t += EllipticTheta[2, a, p]*EllipticTheta[2, b, q]*q/(p^(1/4)*q^(1/4))];
Return[t];
];
CubicThetaA[q_] /;
(NumericQ[q] && Abs[q] < 1 && Precision[q] < Infinity) :=
(QPochhammer[q]^3 + 9*q*QPochhammer[q^9]^3) / QPochhammer[q^3];
CubicThetaA /: HoldPattern[Derivative[n_][CubicThetaA]] /; n > 0 := Derivative[n - 1][CubicThetaAPrime];
CubicThetaB[q_] /;
(NumericQ[q] && Abs[q] < 1 && Precision[q] < Infinity) :=
QPochhammer[q]^3 / QPochhammer[q^3];
CubicThetaB /: HoldPattern[Derivative[n_][CubicThetaB]] /; n > 0 := Derivative[n - 1][CubicThetaBPrime];
CubicThetaC[q_] /;
(NumericQ[q] && Abs[q] < 1 && Precision[q] < Infinity) :=
3 * q^(1/3) * QPochhammer[q^3]^3 / QPochhammer[q];
CubicThetaC /: HoldPattern[Derivative[n_][CubicThetaC]] /; n > 0 := Derivative[n - 1][CubicThetaCPrime];
CubicThetaAPrime[q_] /;
(NumericQ[q] && Abs[q] < 1 && Precision[q] < Infinity) :=
With[{a = CubicThetaA[q], c = CubicThetaC[q]},
(c^3/3 - a^3/12 + a*WeierstrassZeta[1, WeierstrassInvariants[{1, -I*Log[q]/(2*Pi)}]]/Pi^2)/q
];
CubicThetaAPrime /: HoldPattern[Derivative[1][CubicThetaAPrime]] :=
(With[{a = CubicThetaA[#], b = CubicThetaB[#], c = CubicThetaC[#], ap = CubicThetaAPrime[#]},
2*b^3*c^3/(a*(3*#)^2) - ap/# + 2*ap^2/a
] &);
CubicThetaBPrime[q_] /;
(NumericQ[q] && Abs[q] < 1 && Precision[q] < Infinity) :=
With[{a = CubicThetaA[q], b = CubicThetaB[q]},
b*(-a^2/12 + WeierstrassZeta[1, WeierstrassInvariants[{1, -I*Log[q]/(2*Pi)}]]/Pi^2)/q
];
CubicThetaBPrime /: HoldPattern[Derivative[1][CubicThetaBPrime]] :=
(With[{a = CubicThetaA[#], b = CubicThetaB[#], c = CubicThetaC[#], bp = CubicThetaBPrime[#]},
-a*b*c^3/(3*#)^2 - bp/# + 2*bp^2/b
] &);
CubicThetaCPrime[q_] /;
(NumericQ[q] && Abs[q] < 1 && Precision[q] < Infinity) :=
With[{a = CubicThetaA[q], c = CubicThetaC[q]},
c*(a^2/4 + WeierstrassZeta[1, WeierstrassInvariants[{1, -I*Log[q]/(2*Pi)}]]/Pi^2)/q
];
CubicThetaCPrime /: HoldPattern[Derivative[1][CubicThetaCPrime]] :=
(With[{a = CubicThetaA[#], b = CubicThetaB[#], c = CubicThetaC[#], cp = CubicThetaCPrime[#]},
-a*b^3*c/(3*#)^2 - cp/# + 2*cp^2/c
] &);
End[];
SetAttributes[{CubicTheta, CubicThetaA, CubicThetaB, CubicThetaC, CubicThetaAPrime, CubicThetaBPrime, CubicThetaCPrime}, {Listable, NumericFunction, ReadProtected}];
Protect[CubicTheta, CubicThetaA, CubicThetaB, CubicThetaC, CubicThetaAPrime, CubicThetaBPrime, CubicThetaCPrime];
EndPackage[];
Test cases for 0 < q < 1:
Module[{a, b, c, q},
q = RandomReal[WorkingPrecision -> 20];
a = CubicThetaA[q];
b = CubicThetaB[q];
c = CubicThetaC[q];
Assert[TrueQ[And[
CubicThetaA[q^2] == a*Cos[(2/3)*ArcTan[c^(3/2)/b^(3/2)]],
CubicThetaB[q^2] == a^(1/2)*b^(1/2)*Cos[(1/3)*ArcCos[b^(3/2)/a^(3/2)]],
CubicThetaC[q^2] == a^(1/2)*c^(1/2)*Sin[(1/3)*ArcSin[c^(3/2)/a^(3/2)]],
CubicThetaA[q^3] == (1/3)*(a+2*b),
CubicThetaB[q^3] == ((1/3)*b*(a^2+a*b+b^2))^(1/3),
CubicThetaC[q^3] == (1/3)*(a-b),
CubicThetaA[q^4] == (1/4)*(a+6^(1/2)*b^(3/4)*c^(3/4)*a^(-1/2)*Sin[(2/3)*ArcTan[c^(3/2)/b^(3/2)]]^(-1/2)),
CubicThetaB[q^4] == (1/4)*(b+3^(1/2)*b^(1/4)*c^(3/4)*Tan[(1/3)*ArcTan[c^(3/2)/b^(3/2)]]^(-1/2)),
CubicThetaC[q^4] == (1/4)*(c-3^(1/2)*b^(3/4)*c^(1/4)*Tan[(1/3)*ArcTan[c^(3/2)/b^(3/2)]]^(1/2)),
CubicThetaA[q^(1/2)] == 2*a*Cos[(2/3)*ArcTan[b^(3/2)/c^(3/2)]],
CubicThetaB[q^(1/2)] == 2*a^(1/2)*b^(1/2)*Sin[(1/3)*ArcSin[b^(3/2)/a^(3/2)]],
CubicThetaC[q^(1/2)] == 2*a^(1/2)*c^(1/2)*Cos[(1/3)*ArcCos[c^(3/2)/a^(3/2)]],
CubicThetaA[q^(1/3)] == a+2*c,
CubicThetaB[q^(1/3)] == a-c,
CubicThetaC[q^(1/3)] == (9*c*(a^2+a*c+c^2))^(1/3),
CubicThetaA[q^(1/4)] == (a+6^(1/2)*b^(3/4)*c^(3/4)*a^(-1/2)*Sin[(2/3)*ArcTan[b^(3/2)/c^(3/2)]]^(-1/2)),
CubicThetaB[q^(1/4)] == (b-3^(1/2)*b^(1/4)*c^(3/4)*Tan[(1/3)*ArcTan[b^(3/2)/c^(3/2)]]^(1/2)),
CubicThetaC[q^(1/4)] == (c+3^(1/2)*b^(3/4)*c^(1/4)*Tan[(1/3)*ArcTan[b^(3/2)/c^(3/2)]]^(-1/2))
]]];
] & // Block[{$AssertFunction = Automatic}, #[]] &;
Level 5 and 13 analogues:
Module[{q, f, α, β},
f[a_List, q_] := Times @@ (QPochhammer[#, q] & /@ a);
q = RandomReal[WorkingPrecision -> 50];
(* Level 5 *)
α = GoldenRatio;
β = 1/α;
Assert[(f[q^{2,3},q^5]^5 - α^5*q*f[q^{1,4},q^5]^5)*f[{q^5},q^5]^8 == f[(-1)^((2/5)*{1,4})*q,q]^5*f[{q},q]^8];
Assert[(f[q^{2,3},q^5]^5 + β^5*q*f[q^{1,4},q^5]^5)*f[{q^5},q^5]^8 == f[(-1)^((2/5)*{2,3})*q,q]^5*f[{q},q]^8];
Assert[f[q^{10,15,25},q^25] - α*q*f[q^{5,20,25},q^25] == f[(-1)^((2/5)*{1,4,0})*q,q]];
Assert[f[q^{10,15,25},q^25] + β*q*f[q^{5,20,25},q^25] == f[(-1)^((2/5)*{2,3,0})*q,q]];
(* Level 13 *)
α = (3 + Sqrt[13])/2;
β = 1/α;
Assert[f[q^{2,5,6,7,8,11,13,13},q^13] - α*q*f[q^{1,3,4,9,10,12,13,13},q^13] == f[(-1)^((2/13)*{1,3,4,9,10,12,0,0})*q,q]];
Assert[f[q^{2,5,6,7,8,11,13,13},q^13] + β*q*f[q^{1,3,4,9,10,12,13,13},q^13] == f[(-1)^((2/13)*{2,5,6,7, 8,11,0,0})*q,q]];
] & // Block[{$AssertFunction = Automatic}, #[]] &;
Fourier series (with q = exp(-π K(k')/K(k))):
Specific values for α=0 case: