Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Note that after the second when eq2 is built, there is no reason to still assume a dependency of the variables x, y. The value of eq2 is factorized is simply not zero:

p,x,v,y = var('p x v y')
p = (-72*x-264+36*y)/(9*x^2+30*x-119)
v = (-162*x^4+540*x^3-648*x^2*y+13176*x^2-4752*x*y+62340*x-16488*y+153994) \
    / (81*x^4+540*x^3-1242*x^2-7140*x+14161)
eq1 = expand(v^2-(p^4-2*p^3+5*p^2+8*p+4))
eq  = eq1 \
      . subs( { y : sqrt(-x^3+(121/3)*x+(1690/27))     } ) \
      . subs( {     sqrt(-x^3+(121/3)*x+(1690/27)) : y } )
eq2 = eq.simplify_full()
print eq2.factor()

gives:

3456*(27*x^3*y - 1089*x*y + 27*(-x^3 + 121/3*x + 1690/27)^(3/2) - 1690*y)*(9*x^2 + 174*x + 409)/((3*x + 17)^4*(3*x - 7)^4)

This is not zero. Substituting something like . subs( { sqrt(-x^3+(121/3)*x+(1690/27)) : y } ) is a very fragile and unpredictable operation. Instead, one can work algebraically, and simply get the answer to the question that can be mathematically extracted from the posted wish:

Assume that $x,y$ satisfy the algebraic dependency: $$y^2 =-x^3+\frac {121}3x+ \frac{1690}{27}\ .$$ Show than that the variables $p,v$ given in the posted code satisfy $$ v^2=p^4-2p^3+5p^2+8p+4\ .$$

For this, we can work as follows:

R.<x,y> = PolynomialRing( QQ )
J = R.ideal( [ -x^3 + 121/3*x + 1690/27 - y^2 ] )
Q = R.quotient(J)

p = (-72*x - 264 + 36*y) / (9*x^2 + 30*x - 119)
v = (-162*x^4 + 540*x^3 - 648*x^2*y + 13176*x^2 - 4752*x*y + 62340*x - 16488*y + 153994) \
    / (81*x^4 + 540*x^3 - 1242*x^2 - 7140*x + 14161)

eq = (v^2 - (p^4 - 2*p^3 + 5*p^2 + 8*p + 4) ).numerator()

print "The parent of eq is:\n%s" % eq.parent()
print "Is R the parent? %s" % bool( R ==eq.parent() )
print "The image of eq in the quotient ring Q is: %s" % Q(eq)

This gives:

The parent of eq is:
Multivariate Polynomial Ring in x, y over Rational Field
Is R the parent? True
The image of eq in the quotient ring Q is: 0

The above is the solution inside algebraic geometry, arguably the best, the purist world. (Sage also tolerates tacitly expressions in the quotient field of $R$, as $v,p$ are constructed.)

Alternative solution, using only one variable and using "the" radical:

var( 'x' )

y = sqrt( -x^3 + 121/3*x + 1690/27 )

p = (-72*x - 264 + 36*y) / (9*x^2 + 30*x - 119)
v = (-162*x^4 + 540*x^3 - 648*x^2*y + 13176*x^2 - 4752*x*y + 62340*x - 16488*y + 153994) \
    / (81*x^4 + 540*x^3 - 1242*x^2 - 7140*x + 14161)

(v^2 - (p^4 - 2*p^3 + 5*p^2 + 8*p + 4) ).factor()

This gives me:

0
sage: version()
'SageMath version 8.1, Release Date: 2017-12-07'

(Some older sage version may fail to factor expressions that evaluate to zero.)