Using the matrix.sum() we can add the sum of two matrices.
Syntax :
matrix.sum()
Return:
Return the sum of a matrix’s values.
Example 1:
import numpy as np
#Numpy can be used to create matrices.
abc = np.matrix('[4, 1; 12, 3]')
# applying matrix.sum() method
g = abc.sum()
print(g)
Output:
20
Example 2:
import numpy as np
# make matrix with numpy
abc = np.matrix('[4, 1; 12, 3]')
# applying matrix.sum() method to obtain the sum of the matrices
gg = abc.sum()
print(gg)
Output:
20
Related Questions
- How do you add to a matrix in python?
- How do you make a vowel counter in Python?
- How do I remove punctuation from a list in Python?
- How do you transpose a matrix in python?
- How do you find the sum of a matrix in python?
- How do you count the number of vowels in a list in Python?
- How do I remove punctuation from a text file in Python?
- How do you transpose in Python?
- How do you extract a vowel from a string in Python?
- How do you remove special and punctuation characters in Python?
- Is vowel function in Python?
- How do I remove special characters from a list in Python?
- How do you transpose amatrix using Numpy in Python?
Leave a Reply