Ask Your Question
1

won't evaluate answers given by solve()

asked 2016-09-12 22:40:58 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

I am solving an equation and then trying to plug in the answers it gives to show that the answers are correct, but sage will not evaluate the answers i plug in.

solve(x^3+1==0,x)

yields

[x == 1/2*I*sqrt(3)*(-1)^(1/3) - 1/2*(-1)^(1/3), 
x == -1/2*I*sqrt(3)*(-1)^(1/3) - 1/2*(-1)^(1/3), 
x == (-1)^(1/3)]

if you then put into sage (1/2*I*sqrt(3)*(-1)^(1/3) - 1/2*(-1)^(1/3))^3+1 the result it gives is (1/2*I*sqrt(3)*(-1)^(1/3) - 1/2*(-1)^(1/3))^3 + 1. it's like it doesn't know what to do with it's own answers.

edit retag flag offensive close merge delete

Comments

1

What result would you expect ?

tmonteil gravatar imagetmonteil ( 2016-09-12 22:44:58 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2016-09-13 04:22:16 +0100

calc314 gravatar image

You will need to ask it to simplify.

soln=solve(x^3+1==0,x)
soln
f(x) = x^3+1
for s in soln:
    f(s.rhs()).simplify_full()
edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2016-09-12 22:40:58 +0100

Seen: 341 times

Last updated: Sep 13 '16