# simplifying a symbolic expression 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 close merge delete

Sort by » oldest newest most voted

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...).

more

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.