[sympycore] r1212 committed - Bug fixes.

0 views
Skip to first unread message

codesite...@google.com

unread,
Sep 20, 2011, 6:10:21 PM9/20/11
to sympycor...@googlegroups.com
Revision: 1212
Author: pearu.peterson
Date: Tue Sep 20 15:09:34 2011
Log: Bug fixes.
http://code.google.com/p/sympycore/source/detail?r=1212

Modified:
/trunk/sympycore/core.py
/trunk/sympycore/heads/polynomial.py

=======================================
--- /trunk/sympycore/core.py Sat Jan 16 11:58:33 2010
+++ /trunk/sympycore/core.py Tue Sep 20 15:09:34 2011
@@ -474,6 +474,9 @@

def __len__(self): return len(self.data)

+ def copy(self):
+ return type(self)(self.data[:])
+
def __getitem__(self, index):
return self.data[index]

=======================================
--- /trunk/sympycore/heads/polynomial.py Mon Sep 19 13:56:01 2011
+++ /trunk/sympycore/heads/polynomial.py Tue Sep 20 15:09:34 2011
@@ -3,7 +3,7 @@

from .base import Head, heads

-from ..core import init_module, Pair
+from ..core import init_module, Pair, Expr
init_module.import_heads()
init_module.import_numbers()

@@ -59,7 +59,7 @@
"""
new_data = {}
for exp, coeff in data.iteritems():
- new_exp = type(exp)(*exp.pair)
+ new_exp = exp.copy()
new_exp[index] += 1
new_coeff = number_div(cls.ring, coeff, new_exp[index])
new_data[new_exp] = new_coeff
@@ -88,7 +88,10 @@
def expand(self, cls, expr):
new_data = {}
for exp, coeff in expr.data.iteritems():
- new_data[exp] = coeff.expand()
+ if isinstance(coeff, Expr):
+ new_data[exp] = coeff.expand()
+ else:
+ new_data[exp] = coeff
return cls(new_data)

class DensepolyHead(Head):

Reply all
Reply to author
Forward
0 new messages