I want to create an object that I can take formal products and sums of, and also that remembers some extra data. I'd like to use sage's symbolic tools to do it without reimplementing multiplication, etc. For example, I'd like to make a class
I've tried subclassing Expression, but it seems like whenever I try to do some sums or products it just turns my thing into an Expression and forgets that it was a myVar.
Is something like this possible in sage?
You can't solve your problem by subclassing Expression, this requires you to assign data to every expression. Whats the data associated to the Expression a+b?
Since you only want to associate something to variables, you can just use a dictionary:
posted May 12 '11Volker Braun
2238 ● 5 ● 22 ● 52
This is not a complete answer, but here are some useful methods of the symbolic ring and elements for retrieving wrapped python objects:
posted May 11 '11Jason Grout
3185 ● 7 ● 27 ● 71
Asked: May 11 '11
Seen: 117 times
Last updated: May 12 '11
powered by ASKBOT version 0.7.22
Copyright Sage, 2010. Some rights reserved under creative commons license.