Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to find sum of all elements of a matrix in sagemath

I have a matrix of order n say M. If I do sum(M) I would get the a vector in which all the entries would give me the sum of elements of each row of M.

How can I find the sum of all elements of M?

How to find sum of all elements of a matrix in sagemath

I have a matrix of order n say M. If I do sum(M) I would get the a vector in which all the entries would give me the sum of elements of each row of M.

How can I find the sum of all elements of M?M? Does there exist any command which can return the sum of all elements of a matrix?

Please help me out.