线性代数向量乘法_标量乘法属性1 | 使用Python的线性代数

线性代数向量乘法

Prerequisite: Linear Algebra | Defining a Vector

先决条件: 线性代数| 定义向量

Linear algebra is the branch of mathematics concerning linear equations by using vector spaces and through matrices. In other words, a vector is a matrix in n-dimensional space with only one column. In a scalar product, each component of the vector is multiplied by the same scalar value. As a result, the vector's length is increased by a scalar value.

线性代数是使用向量空间和矩阵的线性方程组的数学分支。 换句话说,向量是n维空间中只有一列的矩阵。 在标量积中,向量的每个分量都乘以相同的标量值。 结果,向量的长度增加了一个标量值。

For example: Let a vector a = [4, 9, 7], this is a 3-dimensional vector (x, y, and z)

例如:让向量a = [4、9、7],这是3维向量(x,y和z)

So, a scalar product will be given as b = c*a

因此,标量积将给出为b = c * a

Where c is a constant scalar value (from the set of all real numbers R). The length vector b is c times the length of vector a. This scalar, multiplication follows a property shown below:

其中c是常数标量值(来自所有实数R的集合)。 长度矢量b是向量a的长度c倍。 此标量乘法遵循以下属性:

scalar

Where A and B are two vectors. The python code aims to evaluate the right-hand side and left-hand side for proving the scalar property.

其中AB是两个向量。 python代码旨在评估右侧和左侧以证明标量属性。

标量乘法属性的Python代码 (Python code for Scalar Multiplication Property)

# Vectors in Linear Algebra Sequnce
A = [3, 5, -5, 8]
B = [7 , 7 , 7 , 7]
print("Vector A = ", A)
print("Vector B = ", B)

C = int(input("Enter the value of scalar multiplier: "))

# defining a function for scalar multiplication
def scalar(C, a):
    b = []
    for i in range(len(a)):
        b.append(C*a[i])
    return b    

# defining a function for addition
def add(a,b):
    c = []
    for i in range(len(a)):
        c.append(a[i]+b[i])
    return c

# RHS
ss = add(A,B)
print("Vector C(A + B) = ", scalar(C,ss))
    
# LHS    
An = scalar(C, A)
Bn = scalar(C, B)
print("Vector (CA + CB) = ", add(An,Bn))

print('---Both are same and therefore,')
print('the scalar property in vectors satisfies')
print('this property---')

Output

输出量

Vector A =  [3, 5, -5, 8]
Vector B =  [7, 7, 7, 7]
Enter the value of scalar multiplier: 3
Vector C(A + B) =  [30, 36, 6, 45]
Vector (CA + CB) =  [30, 36, 6, 45]
---Both are same and therefore,
the scalar property in vectors satisfies
this property---


翻译自: https://www.includehelp.com/python/scalar-multiplication-property-1.aspx

线性代数向量乘法

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值