Computing value of j function for imaginary quadratic irrational numbers

Yasuaki.Honda at gmail.com

Klein's elliptic modular j-invariant, or j function in short, has a notable property that the special value for the imaginary quadratic irrational numbers can be computed exactly. The following is the algorithm implemented in Maxima in this notebook.

  • Let's assume $t$ is an imaginary quadratic irrational number, the argument for the j function.
  • Compute the determinant $D$ of $t$.
  • List up all the reduced imaginary quadratic irrational numbers $x_0,\cdots, x_n $whose determinant is $D$.
  • Note that the number of such irrationals $n$ is called the class number of the determinant $D$.
  • Compute the aproximate class equation $ (x-j(x_0))\cdots (x-j(x_n))$ where $j(x_i)$ is computed using q-expansion of j function.
  • Find the exact class equation by rounding up the coefficients of the aproximate class equation and solve it using solve() algebraically.
  • Find the correspondance between aproximate $j(x_i)$ and the exact $j(x_i)$ to know the exact value of $j(x_i)$.

Manual

InFD(p) p is a complex number. InFD(p) checks if p is in the fundamental domain of $j(z)$.

FindInFD(p) p is a complex number. FindInFD(p) returns a complex number in the fundamental domain and equivalent to p. It shows the necessary transformations, too.

float_modular_j(t) t is a complex float number. float_modular_j(t) numerically computes the value of $j(t)$.

FindReducedQuadIrrD(D) D is an integer. FindReducedQuadIrrD(D) computes the list of all the reduced imaginary quadratic irrational numbers whose determinant is $D$.

FindClassNumberD(D) D is an integer. FindClassNumberD(D) computes the class number of the determinant $D$.

FindClassPolyD(var,D) var is a variable, D is an integer. FindClassPolyD(var,D) computes the Hilbert class polynomial of variable $var$, the determinant equal to $D$.

exact_modular_j(t) t is an imaginary quadratic irrational number of the form $ \frac{a_1+a_2\,\sqrt{a_3}}{a_4} $ where $a_1,\cdots,a_4$ are integers, $a_2, a_4$ positive and $a_3$ negative. exact_modular_j(t) computes the exact value (which is an algebraic number) of $j(t)$ using the above algorithm.

In [1]:
install_github("YasuakiHonda","modular_j","main")$
In [2]:
asdf_load("modular_j")$
; processing (IN-PACKAGE :MAXIMA)
; processing (LET NIL ...)
; processing (DEFPROP |$InFD| ...)
; processing (ADD2LNC (QUOTE |$InFD|) ...)
; processing (DEFMTRFUN (|$InFD| $ANY ...) ...)
; processing (DEFPROP |$Ta| ...)
; processing (ADD2LNC (QUOTE |$Ta|) ...)
; processing (DEFMTRFUN (|$Ta| $ANY ...) ...)
; processing (DEFPROP |$FindInFD| ...)
; processing (ADD2LNC (QUOTE |$FindInFD|) ...)
; processing (DEFMTRFUN (|$FindInFD| $ANY ...) ...)
; processing (LET NIL ...)
; processing (DEFPROP $FLOAT_MODULAR_J ...)
; processing (ADD2LNC (QUOTE $FLOAT_MODULAR_J) ...)
; processing (DEFMTRFUN ($FLOAT_MODULAR_J $ANY ...) ...)
; processing (DEFPROP $BFLOAT_MODULAR_J ...)
; processing (ADD2LNC (QUOTE $BFLOAT_MODULAR_J) ...)
; processing (DEFMTRFUN ($BFLOAT_MODULAR_J $ANY ...) ...)
; processing (DEFPROP |$Checkabc| ...)
; processing (ADD2LNC (QUOTE |$Checkabc|) ...)
; processing (DEFMTRFUN (|$Checkabc| $ANY ...) ...)
; processing (DEFPROP |$FindReducedQuadIrrD| ...)
; processing (ADD2LNC (QUOTE |$FindReducedQuadIrrD|) ...)
; processing (DEFMTRFUN (|$FindReducedQuadIrrD| $ANY ...) ...)
; processing (DEFPROP |$FindClassNumberD| ...)
; processing (ADD2LNC (QUOTE |$FindClassNumberD|) ...)
; processing (DEFMTRFUN (|$FindClassNumberD| $FIXNUM ...) ...)
; processing (DEFPROP |$FindClassPolyD| ...)
; processing (ADD2LNC (QUOTE |$FindClassPolyD|) ...)
; processing (DEFMTRFUN (|$FindClassPolyD| $ANY ...) ...)
; processing (DEFPROP $IRR_NUMBER ...)
; processing (ADD2LNC (QUOTE $IRR_NUMBER) ...)
; processing (DEFMTRFUN ($IRR_NUMBER $ANY ...) ...)
; processing (DEFPROP |$FindDetIrr| ...)
; processing (ADD2LNC (QUOTE |$FindDetIrr|) ...)
; processing (DEFMTRFUN (|$FindDetIrr| $ANY ...) ...)
; processing (DEFPROP $EXACT_MODULAR_J ...)
; processing (ADD2LNC (QUOTE $EXACT_MODULAR_J) ...)
; processing (DEFMTRFUN ($EXACT_MODULAR_J $ANY ...) ...)[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$InFD-IMPL| in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$InFD| in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$Ta-IMPL| in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$Ta| in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$FindInFD-IMPL| in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$FindInFD| in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::$FLOAT_MODULAR_J-IMPL in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::$FLOAT_MODULAR_J in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::$BFLOAT_MODULAR_J-IMPL in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::$BFLOAT_MODULAR_J in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$Checkabc-IMPL| in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$Checkabc| in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$FindReducedQuadIrrD-IMPL| in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$FindReducedQuadIrrD| in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$FindClassNumberD-IMPL| in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$FindClassNumberD| in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$FindClassPolyD-IMPL| in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$FindClassPolyD| in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::$IRR_NUMBER-IMPL in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::$IRR_NUMBER in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$FindDetIrr-IMPL| in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$FindDetIrr| in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::$EXACT_MODULAR_J-IMPL in DEFUN
[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::$EXACT_MODULAR_J in DEFUN
In [ ]:

In [3]:
p:(1+sqrt(-3))/2;
Out[3]:
\[\tag{${\it \%o}_{3}$}\frac{\sqrt{3}\,i+1}{2}\]
In [4]:
float_modular_j(p);
Out[4]:
\[\tag{${\it \%o}_{4}$}-1.989519660128281 \times 10^{-13}\]
In [5]:
exact_modular_j(p);
Out[5]:
\[\tag{${\it \%o}_{5}$}0\]
In [6]:
p:(1+sqrt(-15))/2;
Out[6]:
\[\tag{${\it \%o}_{6}$}\frac{\sqrt{15}\,i+1}{2}\]
In [7]:
exact_modular_j(p),factor;
Out[7]:
\[\tag{${\it \%o}_{7}$}-\frac{135\,\left(637\,\sqrt{5}+1415\right)}{2}\]
In [8]:
%,numer;
Out[8]:
\[\tag{${\it \%o}_{8}$}-191657.8328625472\]
In [9]:
float_modular_j(p);
Out[9]:
\[\tag{${\it \%o}_{9}$}-191657.8328625472\]
In [10]:
p:(-1+sqrt(-23))/2;
Out[10]:
\[\tag{${\it \%o}_{10}$}\frac{\sqrt{23}\,i-1}{2}\]
In [11]:
D:FindDetIrr(p);
Out[11]:
\[\tag{${\it \%o}_{11}$}-23\]
In [12]:
FindReducedQuadIrrD(D);
Out[12]:
\[\tag{${\it \%o}_{12}$}\left[ \frac{\sqrt{23}\,i-1}{4} , \frac{\sqrt{23}\,i+1}{4} , \frac{\sqrt{23}\,i-1}{2} \right] \]
In [13]:
FindClassNumberD(D);
Out[13]:
\[\tag{${\it \%o}_{13}$}3\]
In [14]:
FindClassPolyD(x,D);
Out[14]:
\[\tag{${\it \%o}_{14}$}x^3+3491750\,x^2-5151296875\,x+12771880859375\]
In [15]:
exact_modular_j(p),factor;
Out[15]:
\[\tag{${\it \%o}_{15}$}\frac{125\,\left(49\,\left(351747\,\sqrt{23}-371251163\,\sqrt{3}\right)^{\frac{2}{3}}-13967\,2^{\frac{4}{3}}\,3^{\frac{1}{6}}\,\left(351747\,\sqrt{23}-371251163\,\sqrt{3}\right)^{\frac{1}{3}}+15944845\,2^{\frac{2}{3}}\,3^{\frac{1}{3}}\right)}{2^{\frac{1}{3}}\,3^{\frac{7}{6}}\,\left(351747\,\sqrt{23}-371251163\,\sqrt{3}\right)^{\frac{1}{3}}}\]
In [16]:
bfloat(%),fpprec:32;
Out[16]:
\[\tag{${\it \%o}_{16}$}-3.4932256999699333682055047385473_B \times 10^{6}\]
In [17]:
bfloat_modular_j(p),fpprec:32;
Out[17]:
\[\tag{${\it \%o}_{17}$}-3.4932256999699333682055047385475_B \times 10^{6}\]
In [18]:
FindClassPolyD(x,D),x:bfloat_modular_j(p),fpprec:32;
Out[18]:
\[\tag{${\it \%o}_{18}$}0\]