Hi Nathann, On Aug 26, 6:08 pm, Nathann Cohen <nathann.co...@gmail.com> wrote: [...] > But I have two questions now : > * Could it be possible to define variables indexed two times ? > Something like y[0][1]*y[2][3] ? > Could it even be possible to define "dictionary" variables ( I > mean a dictionary of variables ) > y["g"]*y["h"]
I don't see the problem, because *anything* can be stored as value in a dictionary. Or is your question: How do I generate a dictionary? Then, you might do sage: R = QQ['y0, y1, y2'] sage: names = ['a','b','c'] sage: D = dict(zip(names,R.gens())) sage: D {'a': y0, 'b': y1, 'c': y2} sage: D['b'] y1 > * Besides, when I have on one hand a variable y : > y = RR['y0, y1, y2'].gens() > > And a variable x : > > x = RR['x0, x1, x2'].gens() > > How can I easily multiply x[0]*y[2] or add them ? 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. So, AFAIK, you have to explicitly define a ring that fits both, and use conversion (rather than coercion): sage: R.<a,b,c> = QQ[] sage: S.<x,y,z> = QQ[] sage: T = QQ['a,b,c,x,y,z'] sage: a*x --------------------------------------------------------------------------- TypeError Traceback (most recent call last) ... TypeError: unsupported operand parent(s) for '*': 'Multivariate Polynomial Ring in a, b, c over Rational Field' and 'Multivariate Polynomial Ring in x, y, z over Rational Field' sage: T(a)*T(x) # T(a) means: Interprete a as an element of T. a*x 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 -~----------~----~----~----~------~----~------~--~---