简体   繁体   English

线性变换:向量落在非预期的地方,manim

[英]Linear transformation: vectors landing at unintended places, manim

when applying a Linear transformation with a matrix [3, 0],[0, 2], the i hat should elongate to 3 times its length and j hat should elongate to 2 times its length, right?当对矩阵 [3, 0],[0, 2] 应用线性变换时,i hat 应延长至其长度的 3 倍,j hat 应延长至其长度的 2 倍,对吗? The i hat shouldn't move in the direction of j hat because the second coordinate is zero. i hat 不应向 j hat 的方向移动,因为第二个坐标为零。 But when I rendered the animation, what I got is this: See image但是当我渲染动画时,我得到的是这样的:看图片

Look, instead of the i hat (green) moving from (2,-1) to (6,-3) it has moved a little in the direction of j hat?看,不是 i hat(绿色)从 (2,-1) 移动到 (6,-3) 而是朝着 j hat 的方向移动了一点?

Why is this so?为什么会这样? Can somebody explain to me?有人可以向我解释一下吗?

When we "apply" matrix in manim with self.apply_matrix , it is not actually applying the matrix.当我们使用self.apply_matrix在 manim 中“应用”矩阵时,它实际上并没有应用矩阵。

For example, if we self.apply_matrix(A) and then self.apply_matrix(B) , what we should get is the matrix BA which is the result of applying B after A.例如,如果我们self.apply_matrix(A)然后self.apply_matrix(B) ,我们应该得到的是矩阵 BA,它是在 A 之后应用 B 的结果。

But what we actually get is AB.但我们实际得到的是AB。

And as matrix multiplication is not commutative, these are different.由于矩阵乘法不是可交换的,因此它们是不同的。 That is why we get the wrong transformation.这就是我们得到错误转换的原因。

Don't know why manim is behaving this way.不知道为什么manim会这样。

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

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