Declare matrix with real elements



On 7/13/11, Michele Dall'Arno <michele.dallarno at gmail.com> wrote:
> Dear all,
>
> in my Maxima code I need a matrix M of real parameters:
>
> declare(M, nonscalar);
> done
>
> Then I use such real parameters, for example:
>
> x : conjugate(M[1,1]);
> conjugate(M[1,1])
>
> How can I tell Maxima that all the elements of M are real, such that
> conjugate(M[i,j]) = M[i,j] for any i,j?

Try declare(foo, real) or (conversely) declare(foo, complex)
Some parts of Maxima (not sure how pervasive it is) will infer
the real/complex feature of a subscripted variable from the
declaration for just the unscripted variable.
I think that's useful and desirable.
e.g. (declare(x, real), declare(y, complex));
[realpart(x[1]), imagpart(x[1]), conjugate(x[1])];
 => [x[1],0,x[1]]
[realpart(y[1]), imagpart(y[1]), conjugate(y[1])];
 => ['realpart(y[1]),'imagpart(y[1]),conjugate(y[1])]

HTH
Robert Dodier