# Singular

#### D.13.4.10 jInvariant

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

Usage:
jInvariant(f[,#]); f poly, # list

Assume:
- f 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
- it the optional argument # is present the base field should be Q(t) and the optional argument should be one of the following strings:
'ord' : then the return value is of type integer, namely the order of the j-invariant
'split' : then the return value is a list of two polynomials, such that the quotient of these two is the j-invariant

Return:
poly, the j-invariant of the elliptic curve defined by poly

Note:
the characteristic of the base field should not be 2 or 3, unless the input is a plane cubic

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),dp; // jInvariant computes the j-invariant of a cubic jInvariant(x+y+x2y+y3+1/t*xy); ==> (32768t12+24576t10+3072t8-1024t6-96t4+24t2-1)/(256t12+32t10+11t8-t6) // if the ground field has one parameter t, then we can instead // compute the order of the j-invariant jInvariant(x+y+x2y+y3+1/t*xy,"ord"); ==> -6 // one can compare the order of the j-invariant to the tropical j-invariant tropicalJInvariant(x+y+x2y+y3+1/t*xy); ==> // ** int division with `/`: use `div` instead in line >> genus=-genus/2\ ; // we have counted each bounded edge twice<< ==> 6 // the following curve is elliptic as well poly h=x22y11+x19y10+x17y9+x16y9+x12y7+x9y6+x7y5+x2y3+x14y8; // its j-invariant is jInvariant(h); ==> 912673/528 ```