Updates:
Labels: -NeedsReview NeedsBetterPatch
Comment #25 on issue 2132 by asmeurer: Derivative of RootSum
http://code.google.com/p/sympy/issues/detail?id=2132
Now cancel(a.diff(x)) does not cause a traceback, but it doesn't
auto-simplify either. Calling doit() gives this:
In [4]: cancel(a.diff(x).doit())
Out[4]: 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', (330, 0))
---------------------------------------------------------------------------
PolynomialError Traceback (most recent call last)
/Users/aaronmeurer/Documents/Python/sympy/sympy/<ipython console> in
<module>()
/sw/lib/python2.7/site-packages/IPython/Prompts.pyc in __call__(self, arg)
550
551 # and now call a possibly user-defined print mechanism
--> 552 manipulated_val = self.display(arg)
553
554 # user display hooks can change the variable to be
stored in
/sw/lib/python2.7/site-packages/IPython/Prompts.pyc in _display(self, arg)
576 return IPython.generics.result_display(arg)
577 except TryNext:
--> 578 return self.shell.hooks.result_display(arg)
579
580 # Assign the default display method:
/sw/lib/python2.7/site-packages/IPython/hooks.pyc in __call__(self, *args,
**kw)
139 #print "prio",prio,"cmd",cmd #dbg
140 try:
--> 141 ret = cmd(*args, **kw)
142 return ret
143 except ipapi.TryNext, exc:
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/interactive/__init__.pyc
in
result_display(self, arg)
27 """
28 if self.rc.pprint:
---> 29 out = stringify_func(arg)
30
31 if '\n' in out:
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/interactive/__init__.pyc
in
<lambda>(arg)
8 """Initializes pretty-printer depending on the environment. """
9 if pretty_print:
---> 10 stringify_func = lambda arg: pretty(arg, order=order,
use_unicode=use_unicode)
11 else:
12 stringify_func = sstrrepr
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/printing/pretty/pretty.pyc
in
pretty(expr, **settings)
823 try:
824 pp = PrettyPrinter(settings)
--> 825 return pp.doprint(expr)
826 finally:
827 pretty_use_unicode(uflag)
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/printing/pretty/pretty.pyc
in
doprint(self, expr)
29
30 def doprint(self, expr):
---> 31 return self._print(expr).render(**self._settings)
32
33 # empty op so _print(stringPict) returns the same
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/printing/printer.pyc
in _print(self, expr, *args)
229 printmethod = '_print_' + cls.__name__
230 if hasattr(self, printmethod):
--> 231 return getattr(self, printmethod)(expr, *args)
232
233 # Unknown object, fall back to the emptyPrinter.
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/printing/pretty/pretty.pyc
in
_print_Mul(self, product)
557 b[i] = prettyForm(*self._print(b[i]).parens())
558 else:
--> 559 b[i] = self._print(b[i])
560
561 # Construct a pretty form
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/printing/printer.pyc
in _print(self, expr, *args)
229 printmethod = '_print_' + cls.__name__
230 if hasattr(self, printmethod):
--> 231 return getattr(self, printmethod)(expr, *args)
232
233 # Unknown object, fall back to the emptyPrinter.
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/printing/pretty/pretty.pyc
in
_print_Add(self, expr, order)
490 def _print_Add(self, expr, order=None):
491 if order is None and self.order is None:
--> 492 terms = sorted(expr.args, Basic._compare_pretty)
493 else:
494 terms = [ elt[-1] for elt in self.analyze(expr, order) ]
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/basic.pyc in
_compare_pretty(a, b)
273 from sympy.core.symbol import Wild
274 p1, p2, p3 = Wild("p1"), Wild("p2"), Wild("p3")
--> 275 r_a = a.match(p1 * p2**p3)
276 r_b = b.match(p1 * p2**p3)
277 if r_a is not None and r_b is not None:
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/basic.pyc in
match(self, pattern)
1038 """
1039 pattern = sympify(pattern)
-> 1040 return pattern.matches(self, {})
1041
1042 @cacheit
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/mul.pyc in
matches(self, expr, repl_dict, evaluate)
567 expr = sympify(expr)
568 if self.is_commutative and expr.is_commutative:
--> 569 return AssocOp._matches_commutative(self, expr,
repl_dict, evaluate)
570 # todo for commutative parts, until then use the default
matches method for non-commutative products
571 return self._matches(expr, repl_dict, evaluate)
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/operations.pyc
in _matches_commutative(self, expr, repl_dict, evaluate)
183 d1 = w.matches(last_op, repl_dict)
184 if d1 is not None:
--> 185 d2 = self.subs(d1.items()).matches(expr, d1)
186 if d2 is not None:
187 return d2
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/basic.pyc in
subs(self, *args)
705 return self._subs_dict(sequence)
706 elif isinstance(sequence, (list, tuple)):
--> 707 return self._subs_list(sequence)
708 else:
709 raise TypeError("Not an iterable container")
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/basic.pyc in
_subs_list(self, sequence)
746 for old, new in sequence:
747 if hasattr(result, 'subs'):
--> 748 result = result.subs(old, new)
749 return result
750
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/basic.pyc in
subs(self, *args)
710 elif len(args) == 2:
711 old, new = args
--> 712 return self._subs_old_new(old, new)
713 else:
714 raise TypeError("subs accepts either 1 or 2 arguments")
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/cache.pyc in
wrapper(*args, **kw_args)
83 except KeyError:
84 pass
---> 85 func_cache_it_cache[k] = r = func(*args, **kw_args)
86 return r
87
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/basic.pyc in
_subs_old_new(self, old, new)
719 old = sympify(old)
720 new = sympify(new)
--> 721 return self._eval_subs(old, new)
722
723 def _eval_subs(self, old, new):
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/mul.pyc in
_eval_subs(self, old, new)
944 else:
945 return self.__class__(*[s._eval_subs(old, new)
for
--> 946 s in self.args])
947
948 # else the subexpression isn't in the totaly expression
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/power.pyc in
_eval_subs(self, old, new)
212 coeff2,terms2 = (self.exp *
C.log(self.base)).as_coeff_terms()
213 if terms1==terms2: return new ** (coeff1/coeff2) #
(x**(2*y)).subs(exp(3*y*log(x)),z) -> z**(2/3*y)
--> 214 return self.base._eval_subs(old, new) **
self.exp._eval_subs(old, new)
215
216 def as_powers_dict(self):
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/basic.pyc in
_eval_subs(self, old, new)
725 return new
726 else:
--> 727 return self.func(*[arg._eval_subs(old, new) for arg in
self.args])
728
729 def _subs_list(self, sequence):
/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/polys/rootoftools.pyc
in __new__(cls, f, x, indices, radicals, expand)
395
396 if degree <= 0:
--> 397 raise PolynomialError("can't construct RootOf object
for %s" % f)
398
399 if indices is not None and indices is not True:
PolynomialError: can't construct RootOf object for 1 + 19*_z + 115*_z**2 +
161*_z**3
--
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.