Ask Your Question
0

How to determine equality of symbolic expressions?

asked 2025-01-10 19:20:40 +0100

ki gravatar image

updated 2025-01-11 02:29:01 +0100

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?

edit retag flag offensive close merge delete

Comments

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

Max Alekseyev gravatar imageMax Alekseyev ( 2025-01-11 07:35:28 +0100 )edit

Thanks! It has now been reported.

ki gravatar imageki ( 2025-01-11 17:50:35 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2025-01-11 05:15:31 +0100

tolga gravatar image

updated 2025-01-11 06:26:42 +0100

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

Comments

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

Max Alekseyev gravatar imageMax Alekseyev ( 2025-01-11 07:35:58 +0100 )edit

This indeed yields True. Thank you!

ki gravatar imageki ( 2025-01-11 17:50:16 +0100 )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

Stats

Asked: 2025-01-10 19:20:40 +0100

Seen: 27 times

Last updated: 13 hours ago