multiplication with sympy objects

2007-12-28 Thread kent-and
Hi, I would like to be able to switch between swiginac and sympy objects to be able to test both packages (for a while). I have a problem with multiplication with sympy objects. import swiginac import sympy x = swiginac.symbol(x) y = sympy.Symbol(y) class Foo: def __init__(self):

:backmultiplication with sympy objects

2007-12-28 Thread kent-and
Hi, I would like to be able to switch between swiginac and sympy objects to be able to test both packages (for a while). I have a problem with multiplication with sympy objects. import swiginac import sympy x = swiginac.symbol(x) y = sympy.Symbol(y) class Foo: def __init__(self):

Re: :backmultiplication with sympy objects

2007-12-28 Thread Pearu Peterson
On Dec 28, 9:11 am, kent-and [EMAIL PROTECTED] wrote: class Foo: def __init__(self): self.field = 1.0 def __mul__(self, other): print Multiplication in Foo from right self.field = self.field * other def __rmul__(self, other): print

Re: :backmultiplication with sympy objects

2007-12-28 Thread Ondrej Certik
On Dec 28, 2007 10:18 AM, Pearu Peterson [EMAIL PROTECTED] wrote: On Dec 28, 9:11 am, kent-and [EMAIL PROTECTED] wrote: class Foo: def __init__(self): self.field = 1.0 def __mul__(self, other): print Multiplication in Foo from right self.field =

Re: :backmultiplication with sympy objects

2007-12-28 Thread Pearu Peterson
On Dec 28, 10:12 am, Ondrej Certik [EMAIL PROTECTED] wrote: On Dec 28, 2007 10:18 AM, Pearu Peterson [EMAIL PROTECTED] wrote: Try deriving Foo from sympy.Basic. Actually the __mul__ code in sympy is broken as it should return NotImplemented when it gets an unknown (to sympy) object as

Re: :backmultiplication with sympy objects

2007-12-28 Thread Ondrej Certik
On Dec 28, 2007 11:48 AM, Pearu Peterson [EMAIL PROTECTED] wrote: On Dec 28, 10:12 am, Ondrej Certik [EMAIL PROTECTED] wrote: On Dec 28, 2007 10:18 AM, Pearu Peterson [EMAIL PROTECTED] wrote: Try deriving Foo from sympy.Basic. Actually the __mul__ code in sympy is broken as it

Re: :backmultiplication with sympy objects

2007-12-28 Thread kent-and
On 28 Des, 10:18, Pearu Peterson [EMAIL PROTECTED] wrote: On Dec 28, 9:11 am, kent-and [EMAIL PROTECTED] wrote: class Foo: def __init__(self): self.field = 1.0 def __mul__(self, other): print Multiplication in Foo from right self.field =