even more simpler :-) :
sage: V=var("v", n=8) sage: V (v0, v1, v2, v3, v4, v5, v6, v7) sage: v2 v2 sage: V[2] v2 *“Who could ask for anything mooooore ?”* Le mardi 8 mars 2022 à 08:20:07 UTC+1, slelievre a écrit : > Even more practical, I find, is to name the tuple of indexed variables: > ``` > sage: v = SR.var('v', n=8) > sage: v > (v0, v1, v2, v3, v4, v5, v6, v7) > ``` > and to use index notation `v[k]` instead of `vk` to use the variables. > ``` > sage: v[0] > v0 > sage: v[7] > v7 > ``` > > That does not assign the variables to the names `v0` to `v7`: > ``` > sage: v2 > Traceback (most recent call last)= > ... > NameError: name 'v2' is not defined > ``` > > If you really want to use `v0` to `v7` instead of `v[0]` to `v[7]`, > follow the implementation in `var` (accessed with `var??`), > which simply amounts to: > ``` > G = globals() > for vk in v: > G[repr(vk)] = vk > ``` > > After that: > ``` > sage: v2 > v2 > ``` > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/37dc1c01-6cab-41cd-b8e2-b3a06c4e4509n%40googlegroups.com.