# comparing Expressions in python

Hi,

I have an Expression I want to compare:

`var('x,y') x+y == x+y`

But this does not return `True`

. Why?

comparing Expressions in python

Hi,

I have an Expression I want to compare:

`var('x,y') x+y == x+y`

But this does not return `True`

. Why?

add a comment

1

It works for me:

```
sage: var("x, y")
(x, y)
sage: x+y == x+y
x + y == x + y
sage: bool(x+y == x+y)
True
sage: if (x+y == x+y):
....: print 'yep!'
....:
yep!
```

Unless you mean that you want `bool`

to be automatically applied to every equation? Since Sage follows the convention that "False" means "I couldn't see how to prove this was true", this would mean that pretty much every equation would automatically be False from the get-go and so you couldn't do anything with it. For example, `(x-2)*(x+3) == 0`

would be False (`x`

could be 9, after all).

Asked: **
2012-10-28 11:12:00 -0500
**

Seen: **68 times**

Last updated: **Oct 28 '12**

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.