def WeierstrassMap_P1xP1(polynomial, variables=None): r""" Map an anticanonical hypersurface in `\mathbb{P}^1 \times \mathbb{P}^1` into Weierstrass form. Input/output is the same as :func:`WeierstrassMap`, except that the input polynomial must be a standard anticanonical hypersurface in the toric surface `\mathbb{P}^1 \times \mathbb{P}^1`: EXAMPLES:: sage: from sage.schemes.toric.weierstrass_covering import WeierstrassMap_P1xP1 sage: from sage.schemes.toric.weierstrass import WeierstrassForm_P1xP1 sage: R.<x0,x1,y0,y1,a>= QQ[] sage: biquadric = ( x0^2*y0^2 + x1^2*y0^2 + x0^2*y1^2 + x1^2*y1^2 + ....: a * x0*x1*y0*y1*5 ) sage: f, g = WeierstrassForm_P1xP1(biquadric, [x0, x1, y0, y1]); (f,g) (-625/48*a^4 + 25/3*a^2 - 16/3, 15625/864*a^6 - 625/36*a^4 - 100/9*a^2 + 128/27) sage: X, Y, Z = WeierstrassMap_P1xP1(biquadric, [x0, x1, y0, y1]) sage: (-Y^2 + X^3 + f*X*Z^4 + g*Z^6).reduce(R.ideal(biquadric)) 0 sage: R = PolynomialRing(QQ, 'x,y,s,t', order='lex') sage: R.inject_variables() Defining x, y, s, t sage: equation = ( s^2*(x^2+2*x*y+3*y^2) + s*t*(4*x^2+5*x*y+6*y^2) ....: + t^2*(7*x^2+8*x*y+9*y^2) ) sage: X, Y, Z = WeierstrassMap_P1xP1(equation, [x,y,s,t]) sage: f, g = WeierstrassForm_P1xP1(equation, variables=[x,y,s,t]) sage: (-Y^2 + X^3 + f*X*Z^4 + g*Z^6).reduce(R.ideal(equation)) 0 sage: R = PolynomialRing(QQ, 'x,s', order='lex') sage: R.inject_variables() Defining x, s sage: equation = s^2*(x^2+2*x+3) + s*(4*x^2+5*x+6) + (7*x^2+8*x+9) sage: X, Y, Z = WeierstrassMap_P1xP1(equation) sage: f, g = WeierstrassForm_P1xP1(equation) sage: (-Y^2 + X^3 + f*X*Z^4 + g*Z^6).reduce(R.ideal(equation)) 0 """ x,y,s,t = _check_polynomial_P1xP1(polynomial, variables) a00 = polynomial.coefficient({s:2}) V = polynomial.coefficient({s:1}) U = - _partial_discriminant(polynomial, s, t) / 4 Q = invariant_theory.binary_quartic(U, x, y) g = Q.g_covariant() h = Q.h_covariant() if t is None: t = 1 return ( 4*g*t**2, 4*h*t**3, (a00*s+V/2) )
def WeierstrassMap_P1xP1(polynomial, variables=None): r""" Map an anticanonical hypersurface in `\mathbb{P}^1 \times \mathbb{P}^1` into Weierstrass form. Input/output is the same as :func:`WeierstrassMap`, except that the input polynomial must be a standard anticanonical hypersurface in the toric surface `\mathbb{P}^1 \times \mathbb{P}^1`: EXAMPLES:: sage: from sage.schemes.toric.weierstrass_covering import WeierstrassMap_P1xP1 sage: from sage.schemes.toric.weierstrass import WeierstrassForm_P1xP1 sage: R.<x0,x1,y0,y1,a>= QQ[] sage: biquadric = ( x0^2*y0^2 + x1^2*y0^2 + x0^2*y1^2 + x1^2*y1^2 + ....: a * x0*x1*y0*y1*5 ) sage: f, g = WeierstrassForm_P1xP1(biquadric, [x0, x1, y0, y1]); (f,g) (-625/48*a^4 + 25/3*a^2 - 16/3, 15625/864*a^6 - 625/36*a^4 - 100/9*a^2 + 128/27) sage: X, Y, Z = WeierstrassMap_P1xP1(biquadric, [x0, x1, y0, y1]) sage: (-Y^2 + X^3 + f*X*Z^4 + g*Z^6).reduce(R.ideal(biquadric)) 0 sage: R = PolynomialRing(QQ, 'x,y,s,t', order='lex') sage: R.inject_variables() Defining x, y, s, t sage: equation = ( s^2*(x^2+2*x*y+3*y^2) + s*t*(4*x^2+5*x*y+6*y^2) ....: + t^2*(7*x^2+8*x*y+9*y^2) ) sage: X, Y, Z = WeierstrassMap_P1xP1(equation, [x,y,s,t]) sage: f, g = WeierstrassForm_P1xP1(equation, variables=[x,y,s,t]) sage: (-Y^2 + X^3 + f*X*Z^4 + g*Z^6).reduce(R.ideal(equation)) 0 sage: R = PolynomialRing(QQ, 'x,s', order='lex') sage: R.inject_variables() Defining x, s sage: equation = s^2*(x^2+2*x+3) + s*(4*x^2+5*x+6) + (7*x^2+8*x+9) sage: X, Y, Z = WeierstrassMap_P1xP1(equation) sage: f, g = WeierstrassForm_P1xP1(equation) sage: (-Y^2 + X^3 + f*X*Z^4 + g*Z^6).reduce(R.ideal(equation)) 0 """ x, y, s, t = _check_polynomial_P1xP1(polynomial, variables) a00 = polynomial.coefficient({s: 2}) V = polynomial.coefficient({s: 1}) U = -_partial_discriminant(polynomial, s, t) / 4 Q = invariant_theory.binary_quartic(U, x, y) g = Q.g_covariant() h = Q.h_covariant() if t is None: t = 1 return (4 * g * t**2, 4 * h * t**3, (a00 * s + V / 2))
def WeierstrassMap_P2_112(polynomial, variables=None): r""" Map an anticanonical hypersurface in `\mathbb{P}^2[1,1,2]` into Weierstrass form. Input/output is the same as :func:`WeierstrassMap`, except that the input polynomial must be a standard anticanonical hypersurface in weighted projective space `\mathbb{P}^2[1,1,2]`: .. MATH:: \begin{split} p(x,y) =&\; a_{40} x^4 + a_{30} x^3 + a_{21} x^2 y + a_{20} x^2 + \\ &\; a_{11} x y + a_{02} y^2 + a_{10} x + a_{01} y + a_{00} \end{split} EXAMPLES:: sage: from sage.schemes.toric.weierstrass_covering import WeierstrassMap_P2_112 sage: from sage.schemes.toric.weierstrass import WeierstrassForm_P2_112 sage: R = PolynomialRing(QQ, 'x,y,a0,a1,a2,a3,a4', order='lex') sage: R.inject_variables() Defining x, y, a0, a1, a2, a3, a4 sage: equation = y^2 + a0*x^4 + 4*a1*x^3 + 6*a2*x^2 + 4*a3*x + a4 sage: X, Y, Z = WeierstrassMap_P2_112(equation, [x,y]) sage: f, g = WeierstrassForm_P2_112(equation, variables=[x,y]) sage: (-Y^2 + X^3 + f*X*Z^4 + g*Z^6).reduce(R.ideal(equation)) 0 Another example, this time in homogeneous coordinates:: sage: fan = Fan(rays=[(1,0),(0,1),(-1,-2),(0,-1)],cones=[[0,1],[1,2],[2,3],[3,0]]) sage: P112.<x,y,z,t> = ToricVariety(fan) sage: (-P112.K()).sections_monomials() (z^4*t^2, x*z^3*t^2, x^2*z^2*t^2, x^3*z*t^2, x^4*t^2, y*z^2*t, x*y*z*t, x^2*y*t, y^2) sage: C_eqn = sum(_) sage: C = P112.subscheme(C_eqn) sage: WeierstrassForm_P2_112(C_eqn, [x,y,z,t]) (-97/48, 17/864) sage: X, Y, Z = WeierstrassMap_P2_112(C_eqn, [x,y,z,t]) sage: (-Y^2 + X^3 - 97/48*X*Z^4 + 17/864*Z^6).reduce(C.defining_ideal()) 0 """ x,y,z,t = _check_polynomial_P2_112(polynomial, variables) a00 = polynomial.coefficient({y:2}) V = polynomial.coefficient({y:1}) U = - _partial_discriminant(polynomial, y, t) / 4 Q = invariant_theory.binary_quartic(U, x, z) g = Q.g_covariant() h = Q.h_covariant() if t is None: t = 1 return ( 4*g*t**2, 4*h*t**3, (a00*y+V/2) )
def WeierstrassMap_P2_112(polynomial, variables=None): r""" Map an anticanonical hypersurface in `\mathbb{P}^2[1,1,2]` into Weierstrass form. Input/output is the same as :func:`WeierstrassMap`, except that the input polynomial must be a standard anticanonical hypersurface in weighted projective space `\mathbb{P}^2[1,1,2]`: .. MATH:: \begin{split} p(x,y) =&\; a_{40} x^4 + a_{30} x^3 + a_{21} x^2 y + a_{20} x^2 + \\ &\; a_{11} x y + a_{02} y^2 + a_{10} x + a_{01} y + a_{00} \end{split} EXAMPLES:: sage: from sage.schemes.toric.weierstrass_covering import WeierstrassMap_P2_112 sage: from sage.schemes.toric.weierstrass import WeierstrassForm_P2_112 sage: R = PolynomialRing(QQ, 'x,y,a0,a1,a2,a3,a4', order='lex') sage: R.inject_variables() Defining x, y, a0, a1, a2, a3, a4 sage: equation = y^2 + a0*x^4 + 4*a1*x^3 + 6*a2*x^2 + 4*a3*x + a4 sage: X, Y, Z = WeierstrassMap_P2_112(equation, [x,y]) sage: f, g = WeierstrassForm_P2_112(equation, variables=[x,y]) sage: (-Y^2 + X^3 + f*X*Z^4 + g*Z^6).reduce(R.ideal(equation)) 0 Another example, this time in homogeneous coordinates:: sage: fan = Fan(rays=[(1,0),(0,1),(-1,-2),(0,-1)],cones=[[0,1],[1,2],[2,3],[3,0]]) sage: P112.<x,y,z,t> = ToricVariety(fan) sage: (-P112.K()).sections_monomials() (z^4*t^2, x*z^3*t^2, x^2*z^2*t^2, x^3*z*t^2, x^4*t^2, y*z^2*t, x*y*z*t, x^2*y*t, y^2) sage: C_eqn = sum(_) sage: C = P112.subscheme(C_eqn) sage: WeierstrassForm_P2_112(C_eqn, [x,y,z,t]) (-97/48, 17/864) sage: X, Y, Z = WeierstrassMap_P2_112(C_eqn, [x,y,z,t]) sage: (-Y^2 + X^3 - 97/48*X*Z^4 + 17/864*Z^6).reduce(C.defining_ideal()) 0 """ x, y, z, t = _check_polynomial_P2_112(polynomial, variables) a00 = polynomial.coefficient({y: 2}) V = polynomial.coefficient({y: 1}) U = -_partial_discriminant(polynomial, y, t) / 4 Q = invariant_theory.binary_quartic(U, x, z) g = Q.g_covariant() h = Q.h_covariant() if t is None: t = 1 return (4 * g * t**2, 4 * h * t**3, (a00 * y + V / 2))