Ask Your Question

incomplete substitution of expression

asked 2015-10-13 07:44:32 +0200

this post is marked as community wiki

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') 
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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-10-13 11:50:53 +0200

eric_g gravatar image

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()
edit flag offensive delete link more


Thank you @eric_g.. it worked!!

Sha gravatar imageSha ( 2015-10-14 02:33:44 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-10-13 07:44:32 +0200

Seen: 386 times

Last updated: Oct 13 '15