简体   繁体   English

有人可以给出关于 sympy.vector.matrix_to_vector 的几何解释吗?

[英]Can someone give a geometric interpretation about sympy.vector.matrix_to_vector?

SymPy doc gives an explanation about this function sympy.vector.matrix_to_vector SymPy doc解释了这个函数sympy.vector.matrix_to_vector

Converts a vector in matrix form to a Vector instance.将矩阵形式的向量转换为 Vector 实例。

It is assumed that the elements of the Matrix represent the measure numbers of the components of the vector along basis vectors of 'system'.假设矩阵的元素表示向量的分量沿“系统”的基向量的测度数。

and this example和这个例子

>>> from sympy import ImmutableMatrix as Matrix
>>> m = Matrix([1, 2, 3])
>>> from sympy.vector import CoordSys3D, matrix_to_vector
>>> C = CoordSys3D('C')
>>> v = matrix_to_vector(m, C)

It seems that C represents the coordinate axes of a 3d Euclidean space.似乎 C 表示 3d 欧几里得空间的坐标轴。

As per standard convention, Ci, Cj, Ck represent basis vectors along the 𝐗, 𝐘 and 𝐙 axes respectively.按照标准惯例, Ci, Cj, Ck表示沿 𝐗、𝐘 和 𝐙 轴的基向量。

It seems that m = Matrix([1, 2, 3]) is the Matrix we're considering (the matrix to be converted to a vector).似乎m = Matrix([1, 2, 3])是我们正在考虑的矩阵(要转换为向量的矩阵)。 Can someone give a geometric interpretation about converting the vector in matrix m to Vector instance ?有人可以给出关于将矩阵 m 中的向量转换为 Vector 实例的几何解释吗?

Is there a point (1, 2, 3) somewhere in that space?在那个空间的某个地方有一个点 (1, 2, 3) 吗? What is it for?它是做什么用的?

There are actually a lot of implicit assumptions behind " a point (1,2,3) in space ". 实际上,“ 空间中的点(1,2,3) ”后面有很多隐式假设。 When we use coordinates such as (1,2,3) what we really mean is a representation (a specific thing) of an abstract object (an element of a set; the set is a vector space ℝ³ and an element is called a vector). 当我们使用(1,2,3)坐标时,我们真正的意思是抽象对象(集合的元素;集合是向量空间 ℝ³)的表示(特定事物),而一个元素称为向量)。

The way we represent vectors in vector spaces is that we first specify a basis and then use the guaranteed-to-be-real numbers which define a unique linear combination of the basis vectors that specify a given vector in the vector space. 我们在向量空间中表示向量的方式是,我们首先指定一个基数 ,然后使用保证为实数的数字,该数字定义了在向量空间中指定给定向量的基本向量的唯一线性组合。 When we colloquially say " a point (1,2,3) " we imply 当我们通俗地说“ 一个点(1,2,3) ”时,我们暗示

  • the linear space (vector space) is ℝ³ 线性空间(向量空间)为
  • the basis is the canonical Cartesian basis i , j , k which is an orthonormal basis . 的基础是规范的笛卡尔基础ijk这是一个标准正交基

So coming back to your question: the "vector in matrix form" [1, 2, 3] can only be made sense of if we have a good understanding of the vector space and the basis, especially the latter. 因此,回到您的问题:“矩阵形式的向量” [1, 2, 3]仅在我们对向量空间及其基础(尤其是后者)有了很好的理解后才能理解。 If our basis is the Cartesian basis then this is the point 1i + 2j + 3k which has a distance of sqrt(14) from the origin. 如果我们的基础是笛卡尔基础,那么这就是点1i + 2j + 3k ,它与原点的距离为sqrt(14) If our basis was something else (and we can have infinitely many valid bases in a given vector space), say, I = 2i - 3j , J = -k + i and K = j + 2k then on this basis the same coordinates (1,2,3) (note that I used parentheses instead of square brackets to indicate the change in basis) would correspond to the point 1I + 2J + 3K = (2i-3j) + 2(-k + i) + 3(j + 2k) = 4i + 0j + 4k which has a distance of sqrt(32) from the origin. 如果我们的基础是其他事物(并且在给定的向量空间中可以有无限多个有效的基础),例如I = 2i - 3jJ = -k + iK = j + 2k则在此基础上,相同的坐标(1,2,3) (请注意,我使用括号而不是方括号来表示基础的变化)对应于点1I + 2J + 3K = (2i-3j) + 2(-k + i) + 3(j + 2k) = 4i + 0j + 4k ,它与原点的距离为sqrt(32)

So the core of the problem is that coordinates are tied to a basis, and the "matrix form" of the vector can only contain coordinates. 因此,问题的核心是将坐标绑定到基础,并且向量的“矩阵形式”只能包含坐标。 But using sympy.vector you can use abstract vectors as first-class objects, in the doc's example the matrix [1,2,3] gets converted to Ci + 2*Cj + 3*Ck which is a well-defined element of a well-defined linear space. 但是,使用sympy.vector可以将抽象矢量用作一等对象,在doc的示例中,矩阵[1,2,3]转换为Ci + 2*Cj + 3*Ck ,这是a的定义明确的元素定义明确的线性空间。 If you use a different basis to do the conversion you will get a different (but again well-defined and abstract) element of the vector space. 如果使用其他基础进行转换,则将获得向量空间的另一个元素(但又是定义明确的抽象元素)。

And the final step (ie the geometric interpretation) is that elements of the vector space ℝ³ correspond to what we think of as points in 3d real space. 最后一步(即几何学解释)是向量空间ℝ³的元素对应于我们认为的3d实空间中的点。 So yes, in the example you showed from the docs this transformation from "matrix form" to vector is a bit hard to grasp, because there's only a subtle change from concrete representation to abstract. 因此,是的,在您从文档中显示的示例中,从“矩阵形式”到矢量的这种转换有点难以掌握,因为从具体表示到抽象只有细微的变化。 Choosing different bases for the conversion might make it more obvious that what we call [1,2,3] should not be taken for granted. 为转换选择不同的基础可能会更加明显,我们所谓的[1,2,3]不应被视为理所当然。

The function sympy.vector.matrix_to_vector gives you a vector v from a given matrix m . 函数sympy.vector.matrix_to_vector给您一个来自给定矩阵m的向量v

Under your assumption, Ci, Cj, Ck represent basis vectors along the 𝐗, 𝐘 and 𝐙 axes respectively in a 3d Euclidean space, v is a vector that starts from the origin and points toward the point (1, 2, 3) . 在您的假设下, Ci, Cj, Ck代表3d欧几里得空间中沿𝐗,𝐘和𝐙轴的基本向量, v是从原点开始并指向点(1、2、3)的向量

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM