# $Source: /u/maple/research/lib/algcurves/src/RCS/j_invariant,v $ # $Notify: hoeij@sci.kun.nl $ macro( j_invariant=`algcurves/j_invariant` ): macro( g_normal=`algcurves/g_normal` ): # 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 options `Copyright (c) 1996 Waterloo Maple Inc. All rights reserved.`; readlib(`algcurves/g_expand`): # to read g_normal f:=collect(F,{x,y},'distributed',g_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:=collect(f/lcoeff(f,y),y,g_normal); f:=collect(subs(y=y-coeff(f,y,1)/2,f),y,g_normal); f:=coeff(f,y,0); # Take the factors with odd multiplicity f:=numer(f)*denom(f); f:=collect(convert([seq(`if`(irem(i[2],2)=0,1,i[1]), i=evala(Sqrfree(f),'expanded')[2])],`*`),x,g_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; g_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) else readlib(`algcurves/Weierstrassform`)(f,x,y, `algcurves/x0`,`algcurves/y0`,`j invariant`) fi end: #savelib ('j_invariant','`algcurves/j_invariant.m`'):