Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 1648 by [email protected]: trigsimp fails
http://code.google.com/p/sympy/issues/detail?id=1648

Hi,

I have a problem using trigsimp.
Following two lines of code:

In [1]: from sympy import *
In [2]: trigsimp(sympify('1.0+sin(x)'))

lead to the error listed below.

If you try to run

In [3]: trigsimp(sympify('1+sin(x)'))

instead, everything works fine:
Out[3]: 1 + sin(x)

What goes wrong here?

Best wishes from Dresden, Germany

Christian

Error Message:
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', (74, 0))

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

C:\Programme\pythonxy\startups\<ipython console> in <module>()

C:\Python25\lib\site-packages\sympy\simplify\simplify.pyc in trigsimp(expr,
deep
, recursive)
     766         result = g
     767     else:
--> 768         result = trigsimp_nonrecursive(expr, deep)
     769
     770     # do some final simplifications like sin/cos -> tan:

C:\Python25\lib\site-packages\sympy\simplify\simplify.pyc in
trigsimp_nonrecursi
ve(expr, deep)
     872                 continue
     873
--> 874             m = expr.match(pattern)
     875             while m is not None:
     876                 if m[a_t] == 0 or -m[a_t] in m[c].args or m[a_t] +  
m[c]
== 0:

C:\Python25\lib\site-packages\sympy\core\basic.pyc in match(self, pattern)
    1421         """
    1422         pattern = sympify(pattern)
-> 1423         return pattern.matches(self, {})
    1424
    1425     def solve4linearsymbol(eqn, rhs, symbols = None):

C:\Python25\lib\site-packages\sympy\core\operations.pyc in
_matches_commutative(
pattern, expr, repl_dict, evaluate)
     137                 d1 = w.matches(last_op, repl_dict)
     138                 if d1 is not None:
--> 139                     d2 = pattern.matches(expr, d1, evaluate=True)
     140                     if d2 is not None:
     141                         return d2

C:\Python25\lib\site-packages\sympy\core\operations.pyc in
_matches_commutative(
pattern, expr, repl_dict, evaluate)
      98                 pat = pat.subs(old, new)
      99             if pat != pattern:
--> 100                 return pat.matches(expr, repl_dict)
     101
     102         # handle simple patterns

C:\Python25\lib\site-packages\sympy\core\operations.pyc in
_matches_commutative(
pattern, expr, repl_dict, evaluate)
     122             newpattern = pattern.__class__(*wild_part)
     123             newexpr = pattern.__class__._combine_inverse(expr,
pattern._
_class__(*exact_part))
--> 124             return newpattern.matches(newexpr, repl_dict)
     125
     126         # now to real work ;)

C:\Python25\lib\site-packages\sympy\core\operations.pyc in
_matches_commutative(
pattern, expr, repl_dict, evaluate)
     135             while tmp:
     136                 w = tmp.pop()
--> 137                 d1 = w.matches(last_op, repl_dict)
     138                 if d1 is not None:
     139                     d2 = pattern.matches(expr, d1, evaluate=True)

C:\Python25\lib\site-packages\sympy\core\mul.pyc in matches(pattern, expr,
repl_
dict, evaluate)
     543         expr = sympify(expr)
     544         if pattern.is_commutative and expr.is_commutative:
--> 545             return AssocOp._matches_commutative(pattern, expr,
repl_dict
, evaluate)
     546         # todo for commutative parts, until then use the default
matches
  method for non-commutative products
     547         return Basic.matches(pattern, expr, repl_dict, evaluate)

C:\Python25\lib\site-packages\sympy\core\operations.pyc in
_matches_commutative(
pattern, expr, repl_dict, evaluate)
     122             newpattern = pattern.__class__(*wild_part)
     123             newexpr = pattern.__class__._combine_inverse(expr,
pattern._
_class__(*exact_part))
--> 124             return newpattern.matches(newexpr, repl_dict)
     125
     126         # now to real work ;)

C:\Python25\lib\site-packages\sympy\core\mul.pyc in matches(pattern, expr,
repl_
dict, evaluate)
     543         expr = sympify(expr)
     544         if pattern.is_commutative and expr.is_commutative:
--> 545             return AssocOp._matches_commutative(pattern, expr,
repl_dict
, evaluate)
     546         # todo for commutative parts, until then use the default
matches
  method for non-commutative products
     547         return Basic.matches(pattern, expr, repl_dict, evaluate)

C:\Python25\lib\site-packages\sympy\core\operations.pyc in
_matches_commutative(
pattern, expr, repl_dict, evaluate)
     135             while tmp:
     136                 w = tmp.pop()
--> 137                 d1 = w.matches(last_op, repl_dict)
     138                 if d1 is not None:
     139                     d2 = pattern.matches(expr, d1, evaluate=True)

C:\Python25\lib\site-packages\sympy\core\symbol.pyc in matches(pattern,
expr, re
pl_dict, evaluate)
     163         if pattern.exclude:
     164             for x in pattern.exclude:
--> 165                 if x in expr:
     166                     return None
     167                 #else:

C:\Python25\lib\site-packages\sympy\core\basic.pyc in __contains__(self,  
what)
    1122
    1123     def __contains__(self, what):
-> 1124         if self == what: return True
    1125         for x in self._args:
    1126             if what in x:

C:\Python25\lib\site-packages\sympy\core\numbers.pyc in __eq__(self, other)
     364             if other.is_irrational: return False
     365             return other.__eq__(self)
--> 366         if other.is_comparable: other = other.evalf()
     367         if isinstance(other, Number):
     368             return bool(mlib.mpf_eq(self._mpf_,
other._as_mpf_val(self._
prec)))

TypeError: unbound method Basic_evalf() must be called with cos instance as
firs
t argument (got nothing instead)


--
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