# $Source: /u/maple/research/lib/algcurves/src/RCS/j_invariant,v $ # $Notify: mvanhoei@daisy.uwaterloo.ca $ macro( j_invariant=`algcurves/j_invariant` ): # Compute the j invariant for curves with genus 1. j_invariant:=proc(F,x,y) local f,i,c; global `algcurves/x0`,`algcurves/y0`; # global, because then the options remember in the other # procedures work option `Copyright (c) 1996 Waterloo Maple Inc. All rights reserved. Author: M. van Hoeij`; f:=collect(primpart(F,{x,y}),{x,y},'distributed',evala@Normal); if degree(f,y)<2 then error "genus is not 1" elif degree(f,y)=2 then # We could call `algcurves/Weierstrassform` but the following # is likely to be faster: f:=evala(Normal(discrim(f,y))); # Take the factors with odd multiplicity f:=collect(mul(i[1]^irem(i[2],2), i=sqrfree(f,x)[2]),x,evala@Normal); if not member(degree(f,x),{3,4}) then error "genus is not 1" fi; for i from 0 to 4 do c[i]:=coeff(f,x,i) od; evala(Normal( 256*(c[2]^2+12*c[4]*c[0]-3*c[3]*c[1])^3/(-4*c[2]^3*c[0]*c[3]^2-4*c[2]^3*c[4]*c[ 1]^2+16*c[2]^4*c[4]*c[0]-80*c[3]*c[2]^2*c[1]*c[4]*c[0]+144*c[4]^2*c[1]^2*c[0]*c [2]-192*c[4]^2*c[0]^2*c[3]*c[1]+18*c[0]*c[3]^3*c[2]*c[1]-6*c[0]*c[3]^2*c[4]*c[1 ]^2+144*c[0]^2*c[3]^2*c[4]*c[2]+c[3]^2*c[2]^2*c[1]^2-128*c[4]^2*c[0]^2*c[2]^2- 27*c[0]^2*c[3]^4-27*c[4]^2*c[1]^4+256*c[4]^3*c[0]^3-4*c[3]^3*c[1]^3+18*c[3]*c[2 ]*c[1]^3*c[4]) )) elif degree(f,x)<=2 then procname(f,y,x) elif degree(f,{x,y})-ldegree(f,{x,y})<=2 then procname(subs(y=1,c=y,`algcurves/homogeneous`(f,x,y,c)),x,y) elif degree(f,{x,y})=3 then `algcurves/j_deg3`(f,x,y) else i:=`algcurves/x0`,`algcurves/y0`; procname(`algcurves/Weierstrassform`(f,x,y,i ,`no inverse`)[1],i) fi end: # Computes the j-invariant of a polynomial of degree 3. `algcurves/j_deg3`:=proc(f,x,y) local Dj,F,c,d,e,g,B,A; option `Copyright (c) 1998 Waterloo Maple Inc. All rights reserved. Author: M. van Hoeij`; if degree(f,x)<>3 or degree(f,{x,y})>3 then error "input has wrong degree" fi; F:=collect(subs(x=x-coeff(f,x,2)/3/lcoeff(f,x),f/lcoeff(f,x)),{x,y},evala@Normal); if degree(F,y)<3 then return j_invariant(F,x,y) fi; F:=collect(subs(y=y-subs(x=0,coeff(F,y,2))/3/lcoeff(F,y),F),{x,y},evala@Normal); # F=x^3+c*x*y+d*x+e*y+g+y^3*B+x*y^2*A c:=coeff(F,x,1); c,d,A:=coeff(c,y,1),coeff(c,y,0),coeff(c,y,2); g:=coeff(F,x,0); e,g,B:=coeff(g,y,1),coeff(g,y,0),coeff(g,y,3); Dj:=evala(Normal( e*g*c^7*A^2-864*B^3*e^3*d^3+64*B^2*A^3*d^6+1296*d*A^4*g^3*c*B-864*d^2*A^4*g^2* e*B+14*c^6*d^2*e*A*B-81*c^5*e^2*g*A*B+90*c^4*d*e^3*A*B-15*c^7*d*g*A*B-297*e*g* c^5*d*B^2+81*g^2*c^6*B^2+g*c^9*B+207*e^2*c^4*d^2*B^2+5832*g^4*A^3*B^2+1296*g^2 *A^3*d^3*B^2-e*c^8*d*B+64*d^4*A^5*e^2+128*d^2*A^4*e^4+19683*B^4*g^4-648*A^3*e* g^2*c^2*d*B-540*A^3*g^3*c^3*B+864*A^3*e^3*g^2*B+5832*B^4*g^2*d^3+432*B^4*d^6-\ 48*d^3*A^4*e^2*c^2+3888*A^2*g^2*e^2*d*B^2-5832*A^2*g^3*e*c*B^2-48*B^2*A^2*d^5* c^2-e^4*c^4*A^2-e^2*c^6*d*A^2+80*A^3*e^4*c^2*d+12*A^3*e^2*c^4*d^2+64*A^3*e^6-\ 5832*d^2*B^3*A*g^2*e+8748*d*B^3*A*g^3*c+1296*d^4*B^3*A*g*c-864*d^5*B^3*A*e+12* d^4*c^4*A*B^2+540*c^4*A^2*g^2*e*B+72*c^2*e^5*A*B+192*d^4*A^4*c*g*B-128*d^5*A^4 *e*B+648*B^3*d^4*e*c^2+5832*B^3*e^3*g^2-540*B^3*d^3*g*c^3-540*e^3*g*c^3*B^2+ 648*e^4*c^2*d*B^2-d^3*c^6*B^2+432*e^6*B^2+64*g^2*A^6*d^3-208*d^3*A^3*g*c^3*B+ 1152*d^2*A^3*e^2*g*c*B+160*d^4*A^3*e*c^2*B-128*d^3*A^3*e^3*B-e^3*c^6*B-576*A^4 *e^3*g*c*d+48*A^4*g*c^3*e*d^2+504*A^4*e^2*g^2*c^2+12*A^4*g^2*c^4*d-648*d^2*A^2 *g^2*c^2*B^2-432*d^3*A^2*e*g*c*B^2-64*A^5*d^3*e*g*c+432*d^4*A^2*e^2*B^2-48*A^5 *d^2*g^2*c^2-864*A^5*g^3*e*c+576*A^5*g^2*e^2*d+432*g^4*A^6+120*A^2*e^3*d^2*c^2 *B+84*A^2*g*c^5*d^2*B-612*A^2*g*c^3*e^2*d*B-72*A^2*d^3*e*c^4*B-12*A^3*e*g*c^5* d-72*A^3*e^3*g*c^3-A^3*g^2*c^6-288*d^3*e^2*c^2*A*B^2-3888*e^3*g*c*d*A*B^2+648* g*c^3*e*d^2*A*B^2+864*e^4*d^2*A*B^2-81*g^2*c^4*d*A*B^2+4374*e^2*g^2*c^2*A*B^2+ 2187*B^3*g^3*c^3-7290*B^3*e*g^2*c^2*d+7776*B^3*e^2*d^2*g*c )); if Dj=0 then error "genus is not 1" fi; evala(Normal( (48*e^2*A-144*d*e*B-16*d^2*A^2+8*c^2*d*A-c^4+216*c*g*B)^3/Dj )) end: #savelib ('`algcurves/j_deg3`','j_invariant'):