线性代数 矩阵乘法
Linear algebra is the branch of mathematics concerning linear equations by using vector spaces and through matrices. Matrix is the key to linear algebra. All the linear algebra revolves around matrices. One of the major needed steps in linear algebra is scalar multiplication. When a matrix is defined using NumPy, it's easy to code scalar multiplication.
线性代数是使用向量空间和矩阵的线性方程组的数学分支。 矩阵是线性代数的关键。 所有线性代数都围绕矩阵旋转。 线性代数中需要的主要步骤之一是标量乘法。 使用NumPy定义矩阵时,很容易编写标量乘法的代码。
矩阵的标量乘法的Python代码 (Python code for Scalar Multiplication of Matrix)
# Linear Algebra Learning Sequence
# Scalar Multiplication of a Matrix
import numpy as np
# Use of np.array() to define a matrix
V = np.array([[1,2,3],[2,3,5],[3,6,8]])
# Scalar Multiplication of matrix with c =2
print("The Matrix A =\n",V)
print("The MAtrix 2xA =\n",2*V)
Output:
输出:
The Matrix A =
[[1 2 3]
[2 3 5]
[3 6 8]]
The MAtrix 2xA =
[[ 2 4 6]
[ 4 6 10]
[ 6 12 16]]
翻译自: https://www.includehelp.com/python/scalar-multiplication-of-matrix.aspx
线性代数 矩阵乘法