在Python中,可以使用`numpy`库来计算矩阵乘法。以下是使用`numpy`进行矩阵乘法的步骤:
1. 导入`numpy`库:
```python
import numpy as np
2. 创建矩阵:
```python
matrix_a = np.array([[1, 2], [3, 4]])
matrix_b = np.array([[5, 6], [7, 8]])
3. 使用`numpy`的`matmul()`函数进行矩阵乘法:
```python
result_matrix = np.matmul(matrix_a, matrix_b)
4. 打印结果:
```python
print(result_matrix)
输出结果将是:
```
array([[19, 22],
[43, 50]])
`numpy`的`matmul()`函数实现了矩阵乘法运算,它将第一个矩阵的行与第二个矩阵的列相乘,并对结果求和。