调用向量的第i维分量| 使用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 the sequence of learning linear algebra using python, this is article 4. In some of the problems, we need to use a particular component of the vector.

线性代数是使用向量空间和矩阵的线性方程组的数学分支。 换句话说,向量是n维空间中只有一列的矩阵。 在使用python学习线性代数的过程中,这是第4条。在某些问题中,我们需要使用向量的特定分量。

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, if we need to call the yth component of the vector, we are talking about the corresponding value 9. 

因此,如果我们需要调用向量的 y 分量,我们正在讨论的是对应的值9。

In the python code, we will first define a vector and then we will call its 4th component.

在python代码中,我们将首先定义一个向量,然后将其称为第4 组件。

用于调用向量的 i维分量的Python代码 (Python code for calling ith dimensional Component of Vector )

# Vectors in Linear Algebra
a = [3, 5, -5, 8]

print("Vector a = ", a)
# This is a 4-dimensional vector

i = int(input("type dimensional component you want to know: "))
print("Vector's", i," dimensional component = ", a[i-1])

Output

输出量

Vector a =  [3, 5, -5, 8]
type dimensional component you want to know: 4
Vector's 4  dimensional component =  8


翻译自: https://www.includehelp.com/python/calling-ith-dimensional-component-of-vector.aspx

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值