Ask Your Question
1

simplifying a symbolic expression

asked 2020-06-04 08:01:15 +0100

iozen gravatar image

updated 2020-06-04 08:53:01 +0100

FrédéricC gravatar image

Hi I am really tired of not being able to see that sage says the following expression is zero. Instead it returns the same expression. Please help how to make sure that I get 0 for the calculation. Thank you.

q= var('q',domain='positive');

n= var('n',domain='positive');

k= var('k',domain='positive');

x= var('x',domain='positive');

(((q - 1)*x + 1)^n*q^n - ((q^2 - q)*x + q)^n).simplify_full()

((q - 1)*x + 1)^n*q^n - ((q^2 - q)*x + q)^n
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2020-06-04 10:42:09 +0100

Emmanuel Charpentier gravatar image

Well...

sage: var("q,n,k,x", domain="positive")
(q, n, k, x)
sage: (((q - 1)*x + 1)^n*q^n - ((q^2 - q)*x + q)^n).canonicalize_radical()
0

The canonicalize_radical method is often relevant for symbolic expressions involving powers or radicals. Note however that this method may not be always legitimate (see its docs...).

edit flag offensive delete link more

Comments

Thank you very much Emmanuel Carpentier. I tried this in the main problem (the above version was the simplified version) it works like a charm.

iozen gravatar imageiozen ( 2020-06-04 11:05:03 +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

1 follower

Stats

Asked: 2020-06-04 08:01:15 +0100

Seen: 327 times

Last updated: Jun 04 '20