Status: Accepted
Owner: hazelnusse
Labels: Type-Defect Priority-Medium

New issue 1395 by hazelnusse: trigsimp doesn't simplify an expression that  
== 1
http://code.google.com/p/sympy/issues/detail?id=1395

I'm writing some tests for some code that expresses a Vector expression in
the coordinates of a different frame.  I am using Sympy's trigsimp to
simplify expressions, but the following Sympy expression isn't
trigsimplifying:
cos(q4)**2 + sin(q3)**2*sin(q4)**2 + cos(q3)**2*cos(q4)**2*tan(q4)**2

It should simplify to 1, instead it trigsimplifies to:
cos(q4)**2 + sin(q3)**2*sin(q4)**2 + cos(q3)**2*sin(q4)**2

So, I tried trigsimplifying, then factoring, but I got the following error:

In [10]: factor(trigsimp(cos(q4)**2 + sin(q3)**2*sin(q4)**2 +
cos(q3)**2*cos(q4)**2*tan(q4)**2))
ERROR: An unexpected error occurred while tokenizing
input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (33, 0))

---------------------------------------------------------------------------
PolynomialError                           Traceback (most recent call last)

/home/luke/Documents/PythonDynamics/<ipython console> in <module>()

/usr/lib/pymodules/python2.5/sympy/polys/factortools.pyc in factor(f,
*symbols, **flags)
      78             return f
      79
---> 80     coeff, factors = poly_factors(f, *symbols, **flags)
      81
      82     result = 1 # XXX: don't include coeff in the leading factor

/usr/lib/pymodules/python2.5/sympy/polys/factortools.pyc in poly_factors(f,
*symbols, **flags)
      18     """
      19     if not isinstance(f, Poly):
---> 20         f = Poly(f, *symbols)
      21     elif symbols:
      22         raise SymbolsError("Redundant symbols were given")

/usr/lib/pymodules/python2.5/sympy/polys/polynomial.pyc in __new__(cls,
poly, *symbols, **flags)
     400                         terms = Poly._permute(poly, *symbols)
     401         else:
--> 402             terms = Poly._decompose(poly, *symbols)
     403
     404         if terms:

/usr/lib/pymodules/python2.5/sympy/polys/polynomial.pyc in _decompose(poly,
*symbols)
     543                             continue
     544
--> 545                         raise PolynomialError("Can't decompose %s" %
factor)
     546                     else:
     547                         coeff *= factor

PolynomialError: Can't decompose cos(q4)**2

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to