From: Viktor T. T. <vt...@vt...> - 2024-05-03 03:38:58
|
In the case of your example, you could use apply(matrix,makelist(M[i],i,41,50)); or even something like transpose(apply(matrix,makelist(transpose(apply(matrix,makelist(M[i],i,41,50)))[j],j,11,20))); to get a submatrix that consists of rows 41-50, columns 11-20. For what it's worth, there may be more efficient ways to do this, but I just tried it with a 1000 x 1000 matrix, and the result was effectively instantaneous. If you use this often, it is of course easy to encapsulate it in the form of a function. Viktor On 5/2/2024 12:07 PM, 德馬堤 wrote: > > I am also missing the feature posted in > https://sourceforge.net/p/maxima/mailman/message/35760048/ > <https://sourceforge.net/p/maxima/mailman/message/35760048/>. > > In Matlab it is very easy to handle matrices. > > In Maxima the function /submatrix (i_1, …, i_m, M, j_1, …, j_n) /seems > cumbersome if one really wants to go beyond toy problems. Say if I > have a matrix that stores 50 rows, and I want to get only the last 10 > rows, then I would have to write "submatrix(1,2,3,4,5,6,...,40,M)". > > In Matlab it would simply be "M(41:50,:)". > > > And what if the matrix has 1000 rows? > > > I really like Maxima, and it helped me quite a lot in my studies. But > I also got used to Matlab, and if it comes to numerical computing, I > think Maxima should be improved. > > > > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss |