Hi folks,
I want to use Sage to do repeated calculations of simple euclidean
geometry. I was using a library that used classes like this:
class Vector2:
__slots__ = ['x', 'y']
def __init__(self, x, y):
self.x = x
self.y = y
I like to refer to x and y coords of a vector v, not as v[0] and v[1]
but as v.x and v.y which I feel is more intuitive and readable,
especially when dealing with lists of lists of vectors.
>From my reading of Python doco before I came to Sage, tuple ops are
faster than list ops. If I use a vector space then it seems to behave
like I've got 2-tuples of floats, presumably with the numeric types
handled however Sage thinks best. OK, well and good.
So my question is this. Is there some way to "wrap" the VectorSpace
type, giving me the v.x and v.y syntactic sugar, without losing all
the functionality that already exists in Sage for ops on
VectorSpaces? Maybe a subclass of VectorSpace?
--
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