I have an equation with trigonometric functions as below:
eq = Eq(cos(theta_3), a_2*a_3*(-a_2**2/2 - a_3**2/2 + b**2/2 + z_4**2/2))
Then I try solve θ by sympy and code as below:
solve([eq, theta_3 < pi ], theta_3)
But it raise a exception and part of the information as follows:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
File E:\conda\lib\site-packages\sympy\polys\polyutils.py:211, in _parallel_dict_from_expr_if_gens(exprs, opt)
209 base, exp = decompose_power_rat(factor)
--> 211 monom[indices[base]] = exp
212 except KeyError:
KeyError: cos(_theta_3)
During handling of the above exception, another exception occurred:
PolynomialError Traceback (most recent call last)
File E:\conda\lib\site-packages\sympy\solvers\inequalities.py:809, in _solve_inequality(ie, s, linear)
808 try:
--> 809 p = Poly(expr, s)
810 if p.degree() == 0:
File E:\conda\lib\site-packages\sympy\polys\polytools.py:182, in Poly.__new__(cls, rep, *gens, **args)
181 else:
--> 182 return cls._from_expr(rep, opt)
File E:\conda\lib\site-packages\sympy\polys\polytools.py:311, in Poly._from_expr(cls, rep, opt)
310 """Construct a polynomial from an expression. """
--> 311 rep, opt = _dict_from_expr(rep, opt)
312 return cls._from_dict(rep, opt)
Why does such an exception raise? How to correct solve trigonometric functions equation by sympy?