I want to simplify this Latex equation in sympy
\tan{\left(x \right)} \sec{\left(\frac{\pi x}{180} \right)}
So I write this code to simplify this
import sympy as sp
expr = r"\tan{\left(x \right)} \sec{\left(\frac{\pi x}{180} \right)}"
expr = parse_latex(expr)
# Simplifying the expression
simplified_expr = sp.simplify(expr)
print(simplified_expr)
but the result is still like the input equation which was actually tan(x)*sec(pi*x/180)
.So nothing changed by the simplify
method !
I tried searching stack overflow and ChatGpt but everywhere I got only simplify
method, which did not satisfies me.
The simplified version of the expression should be tan(x)*sec(x)
this.
But the simplify
method returns tan(x)*sec(pi*x/180)
this.
Tried Sources:
- Expression simplification in SymPy
- Constant simplification in Sympy and many others.
Any help regarding this will be appreciated :)