Ask Your Question
0

Error in false statement

asked 2019-03-03 10:10:55 -0500

updated 2019-03-03 10:52:52 -0500

vdelecroix gravatar image

Hello

I write in SAGE the following

p=0+0*I
q=1/2+1/2*I
r=3/4+1/3*I
(real(p)==real(q))==false

and it returns "false", but it is true because 0 is not equal to 1/2. Why?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2019-03-03 10:55:57 -0500

vdelecroix gravatar image

The operation

real(p) == real(q)

creates an "inequality". As you can check, the output prints as

>> real(p) == real(q)
0 == (1/2)

You know that the above is false but it is not automatically evaluated within Sage. If you want to force the evaluation you need to run

>>> bool(real(p) == real(q))
False
edit flag offensive delete link more

Comments

thank you very much :-) !!!!!!!!!!!!!!!!!

creyesm1992 gravatar imagecreyesm1992 ( 2019-03-03 11:09:16 -0500 )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

Stats

Asked: 2019-03-03 10:10:55 -0500

Seen: 27 times

Last updated: Mar 03