Incidentally, trying trigsimp with recursive=True, deep=True, or both True
didn't give the desired result.

On Tue, Apr 28, 2009 at 12:22 AM, Luke <hazelnu...@gmail.com> wrote:

> 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
>
>
> I'm dealing with stuff that is going to make heavy use of trigsimp, so I'm
> willing to dig into it a bit.
>
> Should this be filed as a bug, or is there something obvious that I am
> missing.
>
> Thanks,
> ~Luke
>
>
>

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

Reply via email to