Sympy - Simplify expression within domain
问题 Can Sympy automatically simplify an expression that includes terms like this one: cos(x)/(cos(x)**2)**(1/2) which can be simplified to 1 in the domain that I am interested in 0 <= x <= pi/2 ? (Examples of other terms that could be simplified in that domain: acos(cos(x)); sqrt(sin(x)**2); sqrt(cos(2*x) + 1); etc.) 回答1: If you know the functions that are in your expression (such as sin , cos and tan ), you can do the following according to this stack overflow question: from sympy import * x =