First time here? Check out the FAQ!

Ask Your Question
1

How to determine equality of symbolic expressions?

asked 0 years ago

ki gravatar image

updated 0 years ago

tmonteil gravatar image

I expect the following code to yield True, but instead it is False:

var('x, y, n')
assume(n,'integer')
assume(n >= 0)
bool((x-y)^n==(-1)^n*(y-x)^n)

Is there anything I can do to enable the equality to be recognized?

Preview: (hide)

Comments

Looks like a bug, please report at https://github.com/sagemath/sage/issues

Max Alekseyev gravatar imageMax Alekseyev ( 0 years ago )

Thanks! It has now been reported.

ki gravatar imageki ( 0 years ago )
2

1 Answer

Sort by » oldest newest most voted
1

answered 0 years ago

tolga gravatar image

updated 0 years ago

It would be better to try with

simplification_routines(expression1-expression2)==0

instead of

expression1==expression2

or

simplification_routines(expression1)=simplification_routines(expression2)

The following code seems to yield true:

var('x, y, n')
assume(n,'integer')
assume(n >= 0)
bool((((x-y)^n)-(-1)^n*(y-x)^n).expand().canonicalize_radical()==0)
Preview: (hide)
link

Comments

You are fitting things to a known answer. This is not how Sage should work.

Max Alekseyev gravatar imageMax Alekseyev ( 0 years ago )

This indeed yields True. Thank you!

ki gravatar imageki ( 0 years ago )

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: 0 years ago

Seen: 128 times

Last updated: Feb 01