Calculating the Mean from a list of 1 X 1 matrices



Miriam Kraatz escribi?:
> Hello All MAXIMA users, I hope this is the right address to ask questions...
>
> I have a function f that spits out a 1 X 1 matrix [which was created
> by col(row(A,i)j)]. I want to repeat this function, let's say, 100
> times and then compute the mean. When I use makelist(f,i,1,100), listp
> returns that this is indeed a list, but mean does not evaluate.
> Apply("+",...) works, though. What is going on? How can I work around
> this? Obviously, I could use apply and then devide by 100, but that is
> not very elegant and might be problematic later on.
>
> Thanks for any help or comments!
>   

Miriam,

The mean function is defined in the 'descriptive' package:


(%i1) m:makelist(matrix([random(10)]), k, 1, 5);
(%o1)                 [[ 1 ], [ 9 ], [ 5 ], [ 8 ], [ 3 ]]
(%i2) load(descriptive)$
(%i3) mean(m);
                                    [ 26 ]
(%o3)                               [ -- ]
                                    [ 5  ]
(%i4) matrixp(%);
(%o4)                               true


As you can see, the result is also a 1x1 matrix.

hth.

-- 
Mario Rodriguez Riotorto
www.biomates.net