[Maxima] Calculating the Mean from a list of 1 X 1 matrices
biomates at telefonica.net
Sun Sep 16 04:02:42 CDT 2007
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!
The mean function is defined in the 'descriptive' package:
(%i1) m:makelist(matrix([random(10)]), k, 1, 5);
(%o1) [[ 1 ], [ 9 ], [ 5 ], [ 8 ], [ 3 ]]
[ 26 ]
(%o3) [ -- ]
[ 5 ]
As you can see, the result is also a 1x1 matrix.
Mario Rodriguez Riotorto
More information about the Maxima