matrices as parameters of a function



On 24/10/2013 7:08 PM, Jianrong Li wrote:
> Dear Forum,
>
> Could we define a function whose parameters are matrices? For example, 
> the matrices are 2 by 3 matrices. for m =(a, b, c; d, e, f); 
> f(m)=(a+b, c, e; a, b, f);
>
> We can define f(a, b, c, d, e, f):=(a+b, c, e; a, b, f); in maxima. 
> But could we define f(m):=(a+b, c, e; a, b, f); in maxima?
>

(%i1) f(m):=matrix([m[1,1]+m[1,2],m[1,3],m[2,2]],[m[1,1],m[1,2],m[2,3]])$
(%i2) m:matrix([a,b,c],[d,e,f])$

(%i3) f(m);
                                 [ b + a  c  e ]
(%o3)                           [             ]
                                 [   a    b  f ]