Status: Accepted
Owner: ----
CC: mattpap
Labels: Type-Defect Priority-Medium

New issue 1243 by ondrej.certik: bug in trim()
http://code.google.com/p/sympy/issues/detail?id=1243

In [1]: c = cos(x)._eval_rewrite_as_exp(x)

In [2]: t = tan(x)._eval_rewrite_as_exp(x)

In [3]: c*t
Out[3]:
   ⎛ ⅈ⋅x    -ⅈ⋅x⎞
   ⎜ℯ      ℯ    ⎟ ⎛   ⅈ⋅x    -ⅈ⋅x⎞
ⅈ⋅⎜──── + ─────⎟⋅⎝- ℯ    + ℯ    ⎠
   ⎝ 2       2  ⎠
─────────────────────────────────
             ⅈ⋅x    -ⅈ⋅x
            ℯ    + ℯ

In [4]: simplify(_)
Out[4]:
      ⅈ⋅x        5⋅ⅈ⋅x
2⋅ⅈ⋅ℯ    - 2⋅ⅈ⋅ℯ
─────────────────────
     2⋅ⅈ⋅x      4⋅ⅈ⋅x
  4⋅ℯ      + 4⋅ℯ

In [5]: simplify(c*t)
Out[5]:
      ⅈ⋅x        5⋅ⅈ⋅x
2⋅ⅈ⋅ℯ    - 2⋅ⅈ⋅ℯ
─────────────────────
     2⋅ⅈ⋅x      4⋅ⅈ⋅x
  4⋅ℯ      + 4⋅ℯ

In [6]: trim(c*t)
---------------------------------------------------------------------------
PolynomialError                           Traceback (most recent call last)

/home/ondra/repos/sympy/<ipython console> in <module>()

/home/ondra/repos/sympy/sympy/simplify/rewrite.pyc in trim(f, *symbols,
**flags)
     195
     196                 if Q.is_Add:
--> 197                     GQ, Q = extract(Q)
     198                 else:
     199                     GQ = S.One

/home/ondra/repos/sympy/sympy/simplify/rewrite.pyc in extract(f)
     180
     181                     for q in f.args[1:]:
--> 182                         p = gcd(p, q, *symbols)
     183
     184                         if p.is_number:

/home/ondra/repos/sympy/sympy/polys/wrappers.pyc in gcd(*args, **kwargs)

/home/ondra/repos/sympy/sympy/polys/wrappers.pyc in _map_basic(f, n, *args,
**kwargs)
      37
      38 def _map_basic(f, n, *args, **kwargs):
---> 39     result = f(*_conv_args(n, args), **kwargs)
      40
      41     if isinstance(result, (list, tuple, set)):

/home/ondra/repos/sympy/sympy/polys/algorithms.pyc in poly_gcd(f, g,  
*symbols)
     423     """
     424     if not isinstance(f, Poly):
--> 425         f = Poly(f, *symbols)
     426     elif symbols:
     427         raise SymbolsError("Redundant symbols were given")

/home/ondra/repos/sympy/sympy/polys/polynomial.pyc in __new__(cls, poly,
*symbols, **flags)
     398                         terms = Poly._permute(poly, *symbols)
     399         else:
--> 400             terms = Poly._decompose(poly, *symbols)
     401
     402         if terms:

/home/ondra/repos/sympy/sympy/polys/polynomial.pyc in _decompose(poly,
*symbols)
     537                             continue
     538
--> 539                         raise PolynomialError("Can't decompose %s"
% factor)
     540                     else:
     541                         coeff *= factor

PolynomialError: Can't decompose _T10**(13/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