symbolic subscript of literal list or matrix



On 7/21/07, Robert Dodier <robert.dodier at gmail.com> wrote:
>
> At present Maxima complains if the subscript of a literal list or matrix
> is not an integer. E.g. a : [1, 2, 3]; a[k] => error.
>
> I would like to change it so that a subscript expression is returned.
> E.g. a : [1, 2, 3]; a[k] => a[k]


Why not [1,2,3][k]?  I assume we are talking about evaluation here, not just
simplification (in which case the value of a would be irrelevant).

b : matrix([1, 2], [x, y]); b[j, k] => b[j, k]


Why not matrix([1,2],[x,y])[j,k]?

Similarly, matrix([1,2],[3,4])[1,i] should be [1,2][i] and
matrix([1,2],[3,4])[i,1] should be [1,3][i].  If you want to get fancy,
matrix([1,2],[3,4])[i,i] could simplify to [1,4][i]....

I believe Maxima should not trigger an error when there is a sensible
> partially-evaluated form of an expression. This change fixes one such
> case.
>