# $Source: /u/maple/research/lib/algcurves/src/RCS/is_hyperelliptic,v $ # $Notify: mvanhoei@daisy.uwaterloo.ca $ #--> is_hyperelliptic: Test if a curve is hyperelliptic. # # Input: f - A polynomial in 2 variables x and y, describing # an irreducible algebraic curve C. # x,y - variables # # Output: true if the curve is hyperelliptic, false otherwise. macro( is_hyperelliptic=`algcurves/is_hyperelliptic` ): is_hyperelliptic:=proc(f,x,y) local a,b,i,j,g,z; option remember,`Copyright (c) 1999 Waterloo Maple Inc. All rights reserved. Author: M. van Hoeij`; i:=degree(f,{x,y}); j:=min(degree(f,x),degree(f,y),i-ldegree(f,{x,y})); if i<4 or j<2 then false elif j=2 then evalb(`algcurves/genus`(f,x,y) > 1) else b:=`algcurves/differentials`(f,x,y,skip_dx); g:=nops(b); j:=(i-1)*(i-2)/2-g; if g=2 then true elif g<2 or j<2 or (j<4 and {seq(z[3],z=`algcurves/singularities`(f,x,y))}={1}) then false else z:={seq(a[i],i=1..g)}; j:={coeffs(expand(numer(subs(RootOf(f,y)=y,evala(Expand(subs( y=RootOf(f,y),add(a[i]*b[i],i=1..g)^2)))))),z)}; z:={seq(a[i],i=1..nops(j))}; z:=nops(j)-nops(indets(subs(`solve/linear`({coeffs(expand(add(a[i]*j[i], i=1..nops(j))),{x,y})},z),z)) intersect z); # # j is the set of all products b[i]*b[j], i=1..g, j=1..g # z is the dimension of the span of j. If the curve is hyperelliptic # then span(b) is of the form D * span( X^0, X^1, .., X^(g-1) ) # because differentials(Y^2-poly(X),X,Y,skip_dx) = [X^0 .. X^(g-1)]. # So span(j) should be of the form D^2 * span( X^0, X^1, .., X^(2g-2) ) # Hence if the curve is hyperelliptic then z=2g-1. Otherwise we have # z > 2g-1. # Mark van Hoeij, June 1999. if z<2*g-1 then error "should not happen" else evalb(z=2*g-1) fi fi fi end: #savelib('is_hyperelliptic'):