Ask Your Question

Revision history [back]

So you want to know if a specific mathematical expression (like $(x-1)^2 - (x^2-2x))$ is a constant. Just check whether its derivative is zero:

sage: var('C, C2')
sage: diff(((x-1)^2+C) - (x^2-2*x+C2), x)
0
sage: bool(diff(((x-1)^2+C) - (x^2-2*x+C2), x) == 0)
True