Le 16/11/2011 10:08, Chappman a écrit :
HI folks,
In Sagemath I am trying to compute this
a=[1,1]
b=[4,3]
b-a=[3,2]
Assuming you just want to do that a couple of times:
[ a[i]-b[i] for i in range(len(a)) ]
If you want to do it more often, you have to create a class the inherits
from "list" and with a method
__sub__ that makes the job.
I don't believe you really want to be able to subtract *any* pair of
lists ;)
Hope it helps
Laurent
the answer I want is b-a=[3,2] but in sage i come up with a type
Error: unsupported operand type(s) for -: 'list' and 'list'.
Is there any way of rectifying this problem and so that I can compute
b-a ?
Kind Regards
Chappman
--
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/sage-support
URL: http://www.sagemath.org