append in dictionary with matrix values

Solutions on MaxInterview for append in dictionary with matrix values by the best coders in the world

showing results for - "append in dictionary with matrix values"
Maximilian
10 Aug 2017
1print(a**2)
2# [[22 15]
3#  [10  7]]
4print(c**2)
5# [[16  9]
6#  [ 4  1]]
Joe
23 May 2017
1c = np.array([[4, 3], [2, 1]])
2d = np.array([[1, 2], [3, 4]])
3print(c*d)
4# [[4 6]
5#  [6 4]]
María Alejandra
26 Apr 2017
1import numpy as np
2
3a = np.mat('4 3; 2 1')
4b = np.mat('1 2; 3 4')
5print(a)
6# [[4 3]
7#  [2 1]]
8print(b)
9# [[1 2]
10#  [3 4]]
11print(a*b)
12# [[13 20]
13#  [ 5  8]]
Serena
15 Jun 2017
1print(np.dot(c,d))
2# [[13 20]
3#  [ 5  8]]
Jana
12 Mar 2020
1import numpy as np
2
3a = np.array([[4, 3], [2, 1]])
4b = np.array([[1, 2], [3, 4]])
5print(a@b)
6# [[13 20]
7#  [ 5  8]]