As for simplification, you want refine . Unfortunately, it does not yet support the use of inequality syntax, so you will have to use Q.positive or Q.negative (or Q.nonpositive or Q.nonnegative for non-strict inequalities). The most common simplification that it handles is sqrt(x**2) = x if x >= 0 .
>>> refine(sqrt((x - 1)**2), Q.positive(x - 1)) x - 1 >>> refine(sqrt((x - 1)**2), Q.positive(x)) Abs(x - 1)
Note that in the second case, you still get a simpler answer, because it at least knows that x - 1 is real under the given assumptions.
If your assumptions are as simple as โ x positiveโ or โ x negative,โ the best chance of success is to identify it on the symbol itself, for example
>>> Symbol('x', positive=True) >>> sqrt(x**2) x
source share