On 09/05/15 23:39, leif wrote:
> Vincent Delecroix wrote:
>> On 09/05/15 19:22, Travis Scrimshaw wrote:
>>>> A better syntax to access it from PolynomialRing (and also FreeAlgebra 
>>>> and friends) would be 
>>>>
>>>> sage: PolynomialRing(QQ, 'x', (2,2)) 
>>>> Multivariate Polynomial Ring in x00, x01, x02, x10, x11, x12 
>>>>   over Integer Ring 
>>>>
>>>> Please tell me: 
>>>>  - if 'var_array' is useful to somebody (otherwise it will be deprecated) 
>>>>  - if it makes sense to have a feature for the above multi-indexing of 
>>>> variables 
>>>>
>>> I've used it to create arrays of variables to do a symbolic matrix 
>>> computation. When I wrote it, I did it in as simple of a way as I could 
>>> without having to rewrite the constructor, and as such, I only really 
>>> considered (very) small matrices up to 10x10. With some experience using 
>>> it, it would be better to not just use 0, 1, 2, ..., 100 but 000, 001, ..., 
>>> 100 for each index to prevent ambiguity/collisions (i.e., the length of 
>>> each number is the number of digits).
>>
>> Right. I already took care of this. And actually, with the current
>> version you also have the choice for one index
>>
>>    sage: PolynomialRing(QQ, 'x', 11)
>>    Multivariate Polynomial Ring in x0, x1, x2, x3, x4,
>>    x5, x6, x7, x8, x9, x10 over Rational Field
>>
>> versus
>>
>>    sage: PolynomialRing(QQ, 'x', (11,))
>>    Multivariate Polynomial Ring in x00, x01, x02, x03,
>>    x04, x05, x06, x07, x08, x09, x10 over Rational Field
>>
>> (you would get the exact same thing by using `variable_names` directly)
> 
> I'd simply use x_i, x_i_j etc. for subscripting.

This is also doable (currently only in my branch):

sage: from sage.misc.variables import variable_names
sage: variable_names((2,2), 't', sep='_')
('t0_0', 't0_1', 't1_0', 't1_1')
sage: variable_names((2,2), 't_', sep='_')
('t_0_0', 't_0_1', 't_1_0', 't_1_1')

But it lacks an option to to switch off the trailing zeros...

Vincent

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to