# Singular

#### D.13.4.9 weierstrassForm

Procedure from library `tropical.lib` (see tropical_lib).

Usage:
weierstrassForm(wf[,#]); wf poly, # list

Assume:
wf is a a polynomial whose Newton polygon has precisely one interior lattice point, so that it defines an elliptic curve on the toric surface corresponding to the Newton polygon

Return:
poly, the Weierstrass normal form of the polynomial

Note:
- the algorithm for the coefficients of the Weierstrass form is due to Fernando Rodriguez Villegas, villegas@math.utexas.edu
- the characteristic of the base field should not be 2 or 3
- if an additional argument # is given, a simplified Weierstrass form is computed

Example:
 ```LIB "tropical.lib"; ==> Welcome to polymake version ==> Copyright (c) 1997-2015 ==> Ewgenij Gawrilow, Michael Joswig (TU Darmstadt) ==> http://www.polymake.org ring r=(0,t),(x,y),lp; // f is already in Weierstrass form poly f=y2+yx+3y-x3-2x2-4x-6; weierstrassForm(f); ==> -x3-2*x2+xy-4*x+y2+3*y-6 // g is not, but wg is poly g=x+y+x2y+xy2+1/t*xy; poly wg=weierstrassForm(g); wg; ==> -x3+2*x2+1/(t)*xy-x+y2 // but it is not yet simple, since it still has an xy-term, unlike swg poly swg=weierstrassForm(g,1); swg; ==> -x3+(8t2-1)/(4t2)*x2-x+y2 // the j-invariants of all three polynomials coincide jInvariant(g); ==> (-4096t12+12288t10-13056t8+5632t6-816t4+48t2-1)/(16t10-t8) jInvariant(wg); ==> (-4096t12+12288t10-13056t8+5632t6-816t4+48t2-1)/(16t10-t8) jInvariant(swg); ==> (-4096t12+12288t10-13056t8+5632t6-816t4+48t2-1)/(16t10-t8) // the following curve is elliptic as well poly h=x22y11+x19y10+x17y9+x16y9+x12y7+x9y6+x7y5+x2y3; // its Weierstrass form is weierstrassForm(h); ==> -x3+1728*x+y2+27648 ```