[BACK]Return to classno.gp CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / pari / examples

Annotation of OpenXM_contrib/pari/examples/classno.gp, Revision 1.1

1.1     ! maekawa     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: \\                  villegas@math.utexas.edu
        !            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) =
        !            21: {
        !            22:   local(q0,sd,t,c, s = 0, q = 1);
        !            23:
        !            24:   if (!isfundamental(-d), error("Discriminant not fundamental"));
        !            25:   if (!cc, cc = 5);
        !            26:   sd = sqrt(d);
        !            27:   q0 = exp(-2*Pi/sd); c = -4*Pi/sd;
        !            28:   for (n=1, ceil(sd*cc),
        !            29:     q *= q0; t = 1/(1-q);
        !            30:     s += kronecker(-d,n) * q * t * (1 + c*t*n)
        !            31:   );
        !            32:   if (d==3, s *= 3);
        !            33:   if (d==4, s *= 2);
        !            34:   -2*s
        !            35: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>