Note that the @interact feature is not supported in a published worksheet.

You must login and edit a copy of this page (or download it and upload it) in order to do anything useful with it.

{{{id=25| R. = PolynomialRing(QQ) @interact def newton_genus(f=x^2+y^2-1+x^2*y^2): C = Curve(f.homogenize()) if len(C.irreducible_components()) > 1: print "The curve defined by f(x,y) = 0 is not irreducible." return G = sum([point([i,j],pointsize=5,color='black') for i in range(0,7) for j in range(0,7)]) G += sum([point(v,pointsize=20,color='blue') for v in f.newton_polytope().vertices()]) print "Newton polytope of f(x,y):" G += f.newton_polytope().show(alpha=0.3) G += point((1,0),pointsize=20,color='blue')+point((1,1),pointsize=30,color='red') G.show(aspect_ratio=1, ymin=0, ymax=6, xmin=0, xmax=6, figsize=4) print "The projective curve C defined by f(x,y) = 0 is " + ("smooth" if C.is_smooth() else "singular") + ", irreducible, and has genus " + str(abs(C.genus())) + "." # example where the Newton polygon gives the wrong genus: x^2*y - 3*x^2 + x*y + 3*x - y^2 - 1 ///
}}} {{{id=26| @interact def f(t=(1/4,(-15/8,-14/8,..,15/8))): t0 = t x,y,t=var('x,y,t') show([x==(1-t^2)/(1+t^2), y==2*t/(1+t^2)]) t = t0 (x,y) = ((1-t^2)/(1+t^2), 2*t/(1+t^2)) a = 1/3 G = circle((0,0), 1, color='blue', thickness=2) G += arrow((-1-a,-t*a), (x+1*a,y+1*t*a), head=2, color='red') G += point((0,t), pointsize=100, color='black', zorder=100) G += point((-1,0), pointsize=100, color='black', zorder=100) G += point((x,y), pointsize=100, color='lightgreen', zorder=100) G += text("$(0, %s)$"%t, (-.3, t+.2), fontsize=14, color='black', zorder=200) G += text(r"$(%s,\,%s)$"%(x,y), (x+.35, y+.25), fontsize=14, color='black', zorder=200) G.show(aspect_ratio=1, ymin=-2, ymax=2, xmax=2, xmin=-1.5, fontsize=0, figsize=6) /// }}} {{{id=7| @interact def plot_ws_curve(header=text_control("Elliptic curves in short Weierstrass form: y^2 = x^3 + Ax + B"),A=(-4,(-6,-5,..,6)),B=(6,(-6,-5,..,6)),k=selector((RR,QQ,GF(197)),buttons=true)): if 4*A^3+27*B^2 != 0: E=EllipticCurve([k(A),k(B)]) print "Elliptic curve y^2=x^3%+dx%+d over"%(A,B), k if k == QQ: if E.rank() > 0: G = E.plot(xmin=-5, xmax=5) else: G = points([(p[0],p[1]) for p in E.torsion_points() if p[2] != 0], pointsize=20) show(G, xmin=-5,xmax=5,ymin=-10,ymax=10,aspect_ratio=0.5,figsize=6) elif k == RR: G = E.plot(xmin=-5, xmax=5) show(G, xmin=-5,xmax=5,ymin=-10,ymax=10,aspect_ratio=0.5,figsize=6) else: show(E.plot(),figsize=6) else: R.=PolynomialRing(QQ) C=Curve(y^2-x^3-A*x-B) print "singular curve y^2 = x^3 %+dx %+d"%(A,B) show(C.plot()) /// }}} {{{id=5| @interact def plot_edwards_curve(c=(3,(1,..,5)),d=(-1,(-5,-4,..,5))): var('x,y') show(x^2+y^2==c^2*(1+d*x^2*y^2)) implicit_plot(x^2+y^2==c^2*(1+d*x^2*y^2), (x,-4,4), (y,-4,4),axes=true,aspect_ratio=1).show(figsize=6) /// }}} {{{id=12| @interact def plot_multiples(A=(-4,(-6,-5,..,6)),B=(4,(-6,-5,..,6)),n=(1,(1,..,100))): if 4*A^3+27*B^2 == 0: print "singular curve"; return E = EllipticCurve([A,B]) if E.rank() == 0: print E,"\nhas rank 0"; return P = E.gens()[0] print E G = E.plot(xmin=-5,xmax=5) G += point((P[0],P[1]), color='black', pointsize=20) + text("P",(P[0],P[1]+0.5),color='black') Q = P for i in range(2,n+1): Q = Q+P if abs(Q[0]) < 5 and abs(Q[1]) < 10: G += point((Q[0],Q[1]), color='black', pointsize=20) + text("%dP"%i,(Q[0],Q[1]+0.5),color='black') show(G, gridlines=True, frame=True, xmin=-5,xmax=5,ymin=-10,ymax=10,aspect_ratio=0.5,figsize=6) print "%dP = "%n, Q /// }}} {{{id=27| R.=PolynomialRing(RR) @interact def plot_hyperelliptic_curve(header=text_control("Genus 2 curve: y^2 = x^5 + Ax^3 + Bx^2 + Cx + D"),A=(-5,(-6,-5,..,6)),B=(1,(-6,-5,..,6)),C=(4,(-6,-5,..,6)),D=(0,(-6,-5,..,6))): C=Curve(y^2-(x^5 + A*x^3 + B*x^2 + C*x + D)) show(C.plot()) /// }}} {{{id=21| /// }}} {{{id=23| /// }}} {{{id=28| /// }}}