# incomplete substitution of expression This post is a wiki. Anyone with karma >750 is welcome to improve it.

I want to substitute expression of x and y into the equation y^2-x^3+3267*x-45630 which works fine. The tricky part is when i wanted to substitute v^2=p^4-2*p^3+5*p^2+8*p+4 into the equation which would simplify to 0.

p,x,v,y= var('p x v y')
x=3*((5*p^2+24*p+12*v+24)/p^2)
y=108*((-p^3+5*p^2+2*p*v+12*p+4*v+8)/p^3)
eq1=expand(y^2-x^3+3267*x-45630); eq1
eq=eq1.subs({v^2: p^4-2*p^3+5*p^2+8*p+4});eq


Instead of getting 0 I get this expression here :

46656*v/p^2 - 93312*v/p^3 + 233280*v/p^4 - 46656*v^3/p^6 + 373248*v/p^5 + 186624*v/p^6


I notice that the substitution didn't complete because I still have v^3 which did not simplify using the substitution v^2=p^4-2*p^3+5*p^2+8*p+4. Is there any other correct code I should use instead of subs to make it work?

edit retag close merge delete

Sort by » oldest newest most voted

If you substitute v instead of v^2 via

sage: eq=eq1.subs({v: sqrt(p^4-2*p^3+5*p^2+8*p+4)})


then you get zero after simplification:

sage: eq.simplify_full()
0

more