Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

Testing latest pari + WASM + node.js... and it works?! Wow.

28495 views
License: GPL3
ubuntu2004
1
\\ --------------- GP code ---------------------------------------
2
\\
3
\\ Time-stamp: <Fri, Mar 26, 1999 - 14:13:17 - villegas@linux47>
4
\\
5
\\ Description: Compute class number of imaginary quadratic field
6
\\ analytically
7
\\
8
\\ File: classno.gp
9
\\
10
\\ Original Author: Fernando Rodriguez-Villegas
11
\\ [email protected]
12
\\ University of Texas at Austin
13
\\
14
\\ Created: Fri Mar 26 1999
15
\\-----------------------------------------------------------------
16
17
\\ Class number h(-d), -d fundamental.
18
\\ Adjust constant cc for accuracy, default at least 9 decimal places.
19
20
cl(d, cc = 5) =
21
{ my(q0,sd,c, s = 0, q = 1);
22
23
if (!isfundamental(-d), error("Discriminant not fundamental"));
24
sd = sqrt(d);
25
q0 = exp(-2*Pi/sd); c = -4*Pi/sd;
26
for (n=1, ceil(sd*cc),
27
my(t);
28
q *= q0; t = 1/(1-q);
29
s += kronecker(-d,n) * q * t * (1 + c*t*n)
30
);
31
if (d==3, s *= 3,
32
d==4, s *= 2);
33
-2*s;
34
}
35
36