Hi Nathann, On Aug 26, 6:53 pm, Nathann Cohen <nathann.co...@gmail.com> wrote: [...] > be able to live on the same ring... I would have liked to defined a > "dictionary variable" x, once and forever, such that I can afterward > add and multiplicate x["d"] and x["c"]..
There is a multitude of rings in Sage, and much depends on what you really want to do with them. 1. If it is just about multiplying and adding variables and want to be very flexible about the variables, then you may use the Symbolic Ring SR: sage: x = {'a':SR('x'),'b':SR('y')} sage: x['a']*x['b'] + 3.5*x['b']^2 x*y + 3.50000000000000*y^2 sage: _.parent() Symbolic Ring By the way, as you can see from the example, it might be that SR *itself* could play the role of your dictionary, as it translates a given string into a symbolic expression. 2. If you want to do commutative algebra (Groebner bases and such things), you should better use polynomial rings. But then you have to fix variables at some point, and as soon as you get new variables, you have to define a new ring. > > I think there is no easy way, simply because there is no "obvious" > > ring into which both RR['y0, y1, y2'] and RR['x0, x1, x2'] coerce. > > What about RR['y0, y1, y2,x0, x1, x2'] ? I think it's obvious enough > ( as long as both are RR-rings ) What about RR['x0,x1,x2,y0,y1,y2'] ? That's a different ring: sage: RR['x0,x1,x2,y0,y1,y2'] == RR['y0, y1, y2,x0, x1, x2'] False > But why wouldn't we automatically pick the > Ring I mentionned above ? Because it is only one of several possibilities. You can certainly write your program so that you pick one of the possible "big" rings, but that's *your* choice and doesn't necessarily hold for other people. > Aren't there tools in Sage to take the > quotient of a ring if the user wants a smaller one ? Of course: sage: R = QQ['y0, y1, y2'].quotient(['y0^2']*QQ['y0, y1, y2']) sage: R Quotient of Multivariate Polynomial Ring in y0, y1, y2 over Rational Field by the ideal (y0^2) Cheers, Simon --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---