{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Computing value of j function for imaginary quadratic irrational numbers\n", "\n", "### Yasuaki.Honda at gmail.com\n", "\n", "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.\n", "\n", "- Let's assume \\\\(t\\\\) is an imaginary quadratic irrational number, the argument for the j function.\n", "- Compute the determinant \\\\(D\\\\) of \\\\(t\\\\).\n", "- List up all the reduced imaginary quadratic irrational numbers \\\\(x_0,\\cdots, x_n \\\\)whose determinant is \\\\(D\\\\).\n", "- Note that the number of such irrationals \\\\(n\\\\) is called the class number of the determinant \\\\(D\\\\).\n", "- 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.\n", "- Find the exact class equation by rounding up the coefficients of the aproximate class equation and solve it using solve() algebraically.\n", "- Find the correspondance between aproximate \\\\(j(x_i)\\\\) and the exact \\\\(j(x_i)\\\\) to know the exact value of \\\\(j(x_i)\\\\)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Manual\n", "**InFD(p)** p is a complex number. `InFD(p)` checks if p is in the fundamental domain of \\\\(j(z)\\\\).\n", "\n", "**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.\n", "\n", "**float_modular_j(t)** t is a complex float number. `float_modular_j(t)` numerically computes the value of \\\\(j(t)\\\\).\n", "\n", "**FindReducedQuadIrrD(D)** D is an integer. `FindReducedQuadIrrD(D)` computes the list of all the reduced imaginary quadratic irrational numbers whose determinant is \\\\(D\\\\).\n", "\n", "**FindClassNumberD(D)** D is an integer. `FindClassNumberD(D)` computes the class number of the determinant \\\\(D\\\\).\n", "\n", "**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\\\\).\n", "\n", "**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." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "install_github(\"YasuakiHonda\",\"modular_j\",\"main\")$" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "; processing (IN-PACKAGE :MAXIMA)\n", "; processing (LET NIL ...)\n", "; processing (DEFPROP |$InFD| ...)\n", "; processing (ADD2LNC (QUOTE |$InFD|) ...)\n", "; processing (DEFMTRFUN (|$InFD| $ANY ...) ...)\n", "; processing (DEFPROP |$Ta| ...)\n", "; processing (ADD2LNC (QUOTE |$Ta|) ...)\n", "; processing (DEFMTRFUN (|$Ta| $ANY ...) ...)\n", "; processing (DEFPROP |$FindInFD| ...)\n", "; processing (ADD2LNC (QUOTE |$FindInFD|) ...)\n", "; processing (DEFMTRFUN (|$FindInFD| $ANY ...) ...)\n", "; processing (LET NIL ...)\n", "; processing (DEFPROP $FLOAT_MODULAR_J ...)\n", "; processing (ADD2LNC (QUOTE $FLOAT_MODULAR_J) ...)\n", "; processing (DEFMTRFUN ($FLOAT_MODULAR_J $ANY ...) ...)\n", "; processing (DEFPROP $BFLOAT_MODULAR_J ...)\n", "; processing (ADD2LNC (QUOTE $BFLOAT_MODULAR_J) ...)\n", "; processing (DEFMTRFUN ($BFLOAT_MODULAR_J $ANY ...) ...)\n", "; processing (DEFPROP |$Checkabc| ...)\n", "; processing (ADD2LNC (QUOTE |$Checkabc|) ...)\n", "; processing (DEFMTRFUN (|$Checkabc| $ANY ...) ...)\n", "; processing (DEFPROP |$FindReducedQuadIrrD| ...)\n", "; processing (ADD2LNC (QUOTE |$FindReducedQuadIrrD|) ...)\n", "; processing (DEFMTRFUN (|$FindReducedQuadIrrD| $ANY ...) ...)\n", "; processing (DEFPROP |$FindClassNumberD| ...)\n", "; processing (ADD2LNC (QUOTE |$FindClassNumberD|) ...)\n", "; processing (DEFMTRFUN (|$FindClassNumberD| $FIXNUM ...) ...)\n", "; processing (DEFPROP |$FindClassPolyD| ...)\n", "; processing (ADD2LNC (QUOTE |$FindClassPolyD|) ...)\n", "; processing (DEFMTRFUN (|$FindClassPolyD| $ANY ...) ...)\n", "; processing (DEFPROP $IRR_NUMBER ...)\n", "; processing (ADD2LNC (QUOTE $IRR_NUMBER) ...)\n", "; processing (DEFMTRFUN ($IRR_NUMBER $ANY ...) ...)\n", "; processing (DEFPROP |$FindDetIrr| ...)\n", "; processing (ADD2LNC (QUOTE |$FindDetIrr|) ...)\n", "; processing (DEFMTRFUN (|$FindDetIrr| $ANY ...) ...)\n", "; processing (DEFPROP $EXACT_MODULAR_J ...)\n", "; processing (ADD2LNC (QUOTE $EXACT_MODULAR_J) ...)\n", "; processing (DEFMTRFUN ($EXACT_MODULAR_J $ANY ...) ...)[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$InFD-IMPL| in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$InFD| in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$Ta-IMPL| in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$Ta| in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$FindInFD-IMPL| in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$FindInFD| in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::$FLOAT_MODULAR_J-IMPL in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::$FLOAT_MODULAR_J in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::$BFLOAT_MODULAR_J-IMPL in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::$BFLOAT_MODULAR_J in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$Checkabc-IMPL| in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$Checkabc| in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$FindReducedQuadIrrD-IMPL| in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$FindReducedQuadIrrD| in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$FindClassNumberD-IMPL| in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$FindClassNumberD| in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$FindClassPolyD-IMPL| in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$FindClassPolyD| in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::$IRR_NUMBER-IMPL in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::$IRR_NUMBER in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$FindDetIrr-IMPL| in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::|$FindDetIrr| in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::$EXACT_MODULAR_J-IMPL in DEFUN\n", "[SB-KERNEL:REDEFINITION-WITH-DEFUN] redefining MAXIMA::$EXACT_MODULAR_J in DEFUN\n" ] } ], "source": [ "asdf_load(\"modular_j\")$" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "\\[\\tag{${\\it \\%o}_{3}$}\\frac{\\sqrt{3}\\,i+1}{2}\\]" ], "text/plain": [ " sqrt(3) %i + 1\n", "(%o3) --------------\n", " 2" ], "text/x-maxima": [ "(sqrt(3)*%i+1)/2" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p:(1+sqrt(-3))/2;" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "\\[\\tag{${\\it \\%o}_{4}$}-1.989519660128281 \\times 10^{-13}\\]" ], "text/plain": [ "(%o4) - 1.989519660128281e-13" ], "text/x-maxima": [ "-1.989519660128281e-13" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "float_modular_j(p);" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "\\[\\tag{${\\it \\%o}_{5}$}0\\]" ], "text/plain": [ "(%o5) 0" ], "text/x-maxima": [ "0" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "exact_modular_j(p);" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "\\[\\tag{${\\it \\%o}_{6}$}\\frac{\\sqrt{15}\\,i+1}{2}\\]" ], "text/plain": [ " sqrt(15) %i + 1\n", "(%o6) ---------------\n", " 2" ], "text/x-maxima": [ "(sqrt(15)*%i+1)/2" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p:(1+sqrt(-15))/2;" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "\\[\\tag{${\\it \\%o}_{7}$}-\\frac{135\\,\\left(637\\,\\sqrt{5}+1415\\right)}{2}\\]" ], "text/plain": [ " 135 (637 sqrt(5) + 1415)\n", "(%o7) - ------------------------\n", " 2" ], "text/x-maxima": [ "-(135*(637*sqrt(5)+1415))/2" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "exact_modular_j(p),factor;" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "\\[\\tag{${\\it \\%o}_{8}$}-191657.8328625472\\]" ], "text/plain": [ "(%o8) - 191657.8328625472" ], "text/x-maxima": [ "-191657.8328625472" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%,numer;" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "\\[\\tag{${\\it \\%o}_{9}$}-191657.8328625472\\]" ], "text/plain": [ "(%o9) - 191657.8328625472" ], "text/x-maxima": [ "-191657.8328625472" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "float_modular_j(p);" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "\\[\\tag{${\\it \\%o}_{10}$}\\frac{\\sqrt{23}\\,i-1}{2}\\]" ], "text/plain": [ " sqrt(23) %i - 1\n", "(%o10) ---------------\n", " 2" ], "text/x-maxima": [ "(sqrt(23)*%i-1)/2" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p:(-1+sqrt(-23))/2;" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "\\[\\tag{${\\it \\%o}_{11}$}-23\\]" ], "text/plain": [ "(%o11) - 23" ], "text/x-maxima": [ "-23" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "D:FindDetIrr(p);" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "\\[\\tag{${\\it \\%o}_{12}$}\\left[ \\frac{\\sqrt{23}\\,i-1}{4} , \\frac{\\sqrt{23}\\,i+1}{4} , \\frac{\\sqrt{23}\\,i-1}{2} \\right] \\]" ], "text/plain": [ " sqrt(23) %i - 1 sqrt(23) %i + 1 sqrt(23) %i - 1\n", "(%o12) [---------------, ---------------, ---------------]\n", " 4 4 2" ], "text/x-maxima": [ "[(sqrt(23)*%i-1)/4,(sqrt(23)*%i+1)/4,(sqrt(23)*%i-1)/2]" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "FindReducedQuadIrrD(D);" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "\\[\\tag{${\\it \\%o}_{13}$}3\\]" ], "text/plain": [ "(%o13) 3" ], "text/x-maxima": [ "3" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "FindClassNumberD(D);" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "\\[\\tag{${\\it \\%o}_{14}$}x^3+3491750\\,x^2-5151296875\\,x+12771880859375\\]" ], "text/plain": [ " 3 2\n", "(%o14) x + 3491750 x - 5151296875 x + 12771880859375" ], "text/x-maxima": [ "x^3+3491750*x^2-5151296875*x+12771880859375" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "FindClassPolyD(x,D);" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "\\[\\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}}}\\]" ], "text/plain": [ " 2/3\n", "(%o15) (125 (49 (351747 sqrt(23) - 371251163 sqrt(3))\n", " 4/3 1/6 1/3\n", " - 13967 2 3 (351747 sqrt(23) - 371251163 sqrt(3))\n", " 2/3 1/3 1/3 7/6 1/3\n", " + 15944845 2 3 ))/(2 3 (351747 sqrt(23) - 371251163 sqrt(3)) )" ], "text/x-maxima": [ "(125*(49*(351747*sqrt(23)-371251163*sqrt(3))^(2/3)\n", " -13967*2^(4/3)*3^(1/6)*(351747*sqrt(23)-371251163*sqrt(3))^(1/3)\n", " +15944845*2^(2/3)*3^(1/3)))\n", " /(2^(1/3)*3^(7/6)*(351747*sqrt(23)-371251163*sqrt(3))^(1/3))" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "exact_modular_j(p),factor;" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "\\[\\tag{${\\it \\%o}_{16}$}-3.4932256999699333682055047385473_B \\times 10^{6}\\]" ], "text/plain": [ "(%o16) - 3.4932256999699333682055047385473b6" ], "text/x-maxima": [ "-3.4932256999699333682055047385473b6" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bfloat(%),fpprec:32;" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "\\[\\tag{${\\it \\%o}_{17}$}-3.4932256999699333682055047385475_B \\times 10^{6}\\]" ], "text/plain": [ "(%o17) - 3.4932256999699333682055047385475b6" ], "text/x-maxima": [ "-3.4932256999699333682055047385475b6" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "bfloat_modular_j(p),fpprec:32;" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "\\[\\tag{${\\it \\%o}_{18}$}0\\]" ], "text/plain": [ "(%o18) 0" ], "text/x-maxima": [ "0" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "FindClassPolyD(x,D),x:bfloat_modular_j(p),fpprec:32;" ] } ], "metadata": { "kernelspec": { "display_name": "Maxima", "language": "maxima", "name": "maxima" }, "language_info": { "codemirror_mode": "maxima", "file_extension": ".mac", "mimetype": "text/x-maxima", "name": "maxima", "pygments_lexer": "maxima", "version": "5.44.0" } }, "nbformat": 4, "nbformat_minor": 4 }