# Singular

#### D.13.3.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"; ring r=(0,t),(x,y),lp; // f is already in Weierstrass form poly f=y2+yx+3y-x3-2x2-4x-6; weierstrassForm(f); // g is not, but wg is poly g=x+y+x2y+xy2+1/t*xy; poly wg=weierstrassForm(g); wg; // but it is not yet simple, since it still has an xy-term, unlike swg poly swg=weierstrassForm(g,1); swg; // the j-invariants of all three polynomials coincide jInvariant(g); jInvariant(wg); jInvariant(swg); // the following curve is elliptic as well poly h=x22y11+x19y10+x17y9+x16y9+x12y7+x9y6+x7y5+x2y3; // its Weierstrass form is weierstrassForm(h); ```