On Wed, Aug 26, 2009 at 7:56 PM, Robert Bradshaw<rober...@math.washington.edu> wrote: >>> x[1], and then x[1] would create another symbolic variable x[1][1]. >>> >> >> That sounds pretty easy to implement by defining __getitem__ for >> symbolic variables, and making it cache its answer using a dictionary. > > I've advocated for this before--I think it's a great idea. > >> Should one only allow x[integer] or more generally x[anything >> hashable]? > > I would say x[anything symbolic]. Thus one could do > > sage: var('x,a') > sage: x[a] > x[a] > sage: x[a].subs(a=1) > x[1] > > I don't think x[a].subs(x=y) should be y[a], but you should be able > to sub for x[...] as a normal variable. > > - Robert
Yes, this makes a lot of sense to me, since it's very common in mathematics to have expressions like x_i, where i is some variable. So would we have sage: latex(x[3]) x_{3} William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---