Problems handling trigonometric expressions

3 views
Skip to first unread message

Iceman_5

unread,
Dec 17, 2009, 6:12:59 AM12/17/09
to PyDy
I think this is more a problem of sympy than PyDy, but I post it here
because I've found it using PyDy.
There is one point wich velocity is something like: R*qd1*sin
(q1+beta); where beta is an angle (a parameter of the system). When
I've tried to define the velocity of the point with the expression
above I got the next error:

Traceback (most recent call last):
File "motor.py", line 90, in <module>
kanes_eqns = N.form_kanes_equations()
File "F:\Documentos\ENGLOBE_Stirling\python\pydy.py", line 1929, in
form_kanes
_equations
subs(self.symbol_dict)).subs(self.symbol_dict_back).\
File "C:\Archivos de programa\Python264\lib\site-packages\sympy\polys
\factorto
ols.py", line 80, in factor
coeff, factors = poly_factors(f, *symbols, **flags)
File "C:\Archivos de programa\Python264\lib\site-packages\sympy\polys
\factorto
ols.py", line 20, in poly_factors
f = Poly(f, *symbols)
File "C:\Archivos de programa\Python264\lib\site-packages\sympy\polys
\polynomi
al.py", line 455, in __new__
terms = Poly._decompose(poly, *symbols)
File "C:\Archivos de programa\Python264\lib\site-packages\sympy\polys
\polynomi
al.py", line 599, in _decompose
raise PolynomialError("Can't decompose %s" % factor)
sympy.polys.polynomial.PolynomialError: Can't decompose sin(betta +
q1)

I solved it defining two auxiliar parameters s_b and c_b who are
respectively the sin(beta) and cos(beta) an developping the velocity
expression as: R*qd1*(sin(q1)*c_b+cos(q1)*s_b); but if the expression
gets more complicated it could be hard to develop it manually.
There is something to do about that? A simpler method to avoid this
error?

Reply all
Reply to author
Forward
0 new messages