未登录,请登录后再发表信息
最新评论 (0)
播放视频

四元数的可视化

What are quaternions, and how do you visualize them? A story of four dimensions.

What you’re looking at right now is something called quaternion multiplication,
你现在看到的就是所谓的四元数乘法
or rather, you’re looking at a certain representation
也可以说 你看到的是
of a specific motion happening on a four-dimensional sphere
发生在四维球体上的特定运动
being represented in our three-dimensional space
在三维空间表现的一种形式
one which you’ll understand by the end of this video.
这些东西你看完本视频之后 就会明白了
Quaternions are an absolutely fascinating and often underappreciated number system from math.
四元数完全就是一种迷人的而又不被赏识的数制系统
Just as complex numbers are a two-dimensional extension of the real numbers,
正如复数是实数的二维扩展
quaternions are a four-dimensional extension of complex numbers.
四元数就是复数的四维扩展
but they’re not just playful mathematical shenanigans,
但它们不仅是好玩的数学恶作剧
They have a surprisingly pragmatic utility for describing rotation
而且在描述三维旋转
in three dimensions and even for quantum mechanics.
甚至是量子力学方面都超乎寻常的实用
The story of their discovery is also quite famous in math.
四元数的发现史在数学方面也相当的出名
The Irish mathematician William Rowan Hamilton
爱尔兰数学家威廉·罗恩·哈密顿
spent much of his life seeking a three-dimensional
花了大半辈子的时间去寻找
number system analogous to the complex numbers,
一种类似于复数的三维数字系统
and as the story goes,
而且据说
his son would ask him every morning
每天早上 他儿子都会问他
whether or not he had figured out how to divide triples
找没找到如何划分三元组
and he would always say”no, not yet.”
他总是说 没 还没有
But on October 16th, 1843,
但在1843年10月16日
while crossing the Broome Bridge in Dublin,
走在都柏林的布鲁姆桥时
he realized—with a supposed flash of insight—
他灵光一现
that what he needed was not to add
发现自己要做的不是
a single dimension to the complex numbers,
给复数增加一个单独的维度
but to add two more imaginary dimensions:
而是增加两个虚拟的维度:
three imaginary dimensions describing space
也就是用虚拟三维来描述空间
and the real numbers sitting perpendicular to that in some kind of fourth dimension.
实数位于第四维度 垂直于虚拟三维
He carved the crucial equation describing these three imaginary units into the bridge
他把描述这三个虚数单位的关键方程式刻在桥上
which today bears a plaque in his honor showing that equation.
如今人们为了纪念他 就把方程式刻在了石板上
Now you have to understand our modern notion of vectors
你现在所熟知的向量
with their dot product and the cross product and things like that
以及点积 叉积之类的概念
didn’t really exist in Hamilton’s time,
在哈密顿那个时代并不存在
at least not in a standardized form.
至少没有达到标准化的形式
So after his discovery, he pushed hard for quaternions to be the primary language
所以发现四元数之后 他就大力推广
with which we teach students to describe three-dimensional space,
使之成为教学生描述三维空间的第一语言
even forming an official quaternion society to proselytize his discovery.
甚至成立官方四元数学社来安利他发现的四元数
Now, unfortunately, this was balanced with mathematicians on the other side of the fence
不幸的是 他们与反方的数学家们势均力敌
who believed that the confusing notion of quaternion multiplication
反方数学家认为四元数乘法晦涩难懂
was not necessary for describing three dimensions
描述三维空间的时候没有必要用
resulting in some truly hilarious old-timey trash talk legitimately calling them evil.
因此还说了些旧时代的闲话 理所当然的称它们是魔鬼
It’s even believed that the Mad Hatter scene from Alice in Wonderland
甚至有人相信《爱丽丝梦游仙境》中的疯帽匠场景
whose author you may know was an Oxford mathematician
它的作者你可能认识 他是牛津大学的数学家
was written in reference to quaternions:
就是参照四元数所写的
that the chaotic table placement changes were mocking their multiplication,
桌面上混乱的位置变化嘲弄着四元数的乘法运算
and that certain quotes were referencing their non-commutative nature.
某些话语也暗讽四元数不含交换定律
Fast forward about a century
快进到一个世纪之后
and the computing industry gave quaternions a resurgence among
计算机工业助力四元数使其复兴
programmers who work with graphics and robotics
程序员们把它应用于图形与机器人学
and anything involving orientation in 3D space,
以及其他任何涉及三维空间方向的领域
and this is because they give an elegant way to describe and to compute 3D rotations
这是由于四元数为描述和计算三维旋转提供了一种简练的方法
which is computationally more efficient than other methods
在计算上 相比其他方法更为高效
and which also avoids a lot of the numerical errors that arise in these other methods.
还避免了其他方法中出现的许多数值误差
The 20th century also brought quaternions some more love
20世纪还从另外一个完全不同的方向
from a completely different direction, quantum mechanics.
给了四元数更多的眷顾 就是量子力学
You see, the special actions the quaternions describe in four dimensions
你看 四元数在四个维度中描述的特殊动作
are actually quite relevant to the way that two-state systems
与双态系统有着相当紧密的联系
like spin of an electron,
比如说电子自旋
or the polarization of a photon are described mathematically.
抑或是用数学方式描述的光子偏振
What I’ll show you here is a way to
这里我将会为你展示的是
visualize quaternions in their full four-dimensional glory.
一种将四元数在四维空间中可视化的方法
It would surprise me if this approach was fully original,
我并不觉得这是一种完全原创的方法
but I can say that it’s certainly not the standard way to teach quaternions,
但是我敢说这绝对不是四元数的标准教法
and that the specific four-dimensional right-hand-rule image that I’d like to build up to
我想展示的这种四维右手定则图像
is something that I haven’t really seen elsewhere.
还没有在别处见过
Building up an understanding for this visual will take us meaningful time,
建立这种视觉理解力需要花费我们好些时间
but once you have it,
但一旦你理解了
there is a very natural and satisfying intuition for how to think about quaternion multiplication
就会对四元数乘法有着自然而然而又惬意的直觉
It won’t be until the next video
到下一个视频时
that I show you how exactly quaternions describe orientation in three dimensions,
我会展示给你看四元数是如何精确的描述三维转向的
which is for some people the whole reason we care about it,
也就是许多人关注四元数的主要原因
but once we’re able to go at it armed
但是一旦我们建立起相关印象
with the image of what they’re doing to a 4d hyper sphere,
明白四元数到底对四维空间做了什么
there’s a pleasing understanding to be had
就能很好地理解
for the otherwise opaque formulas characterizing this relationship.
描述四元数关系的晦涩难懂的公式
The structure here will be to start by
此时的结构将会是这样的
imagining teaching complex numbers to someone who only understands one dimension,
首先想象一下:教一个只懂一维的人学习复数
then describing 3d rotations to someone who only understands two dimensions,
然后向只懂二维的人描述三维旋转
and ultimately to represent what
最终表示出
quaternions are doing up in four dimensions, within the constraints of our 3d space.
在三维空间约束下 四元数在四维空间中的作用
第一章 直线人小莱
Our first character is Linus the Linelander,
我们的第一章就是直线人小莱
whose mind can only grasp the one-dimensional geometry of lines and the algebra of real numbers.
它仅能理解一维几何和实数
We’re gon na try to describe complex members to Linus,
我们试着向小莱描述复数
and it’s really important for you to empathize with him as much as you can during this,
在此期间 重要的是要尽你所能地站在小莱的立场
because in a few minutes you’re gon na be in his shoes.
因为几分钟之后你将取代它
On the one hand, you could define complex numbers purely algebraically:
一方面 你能用纯代数的方式来定义复数:
you say each one is expressed
表达如下
as some real number plus some other real number times i,
一个实数加上另一个实数乘以i
where i is a newly invented constant
其中i是一个新发明的常数
whose defining property is that i × i = -1.
性质定义为i×i=-1
Then you say to Linus to multiply two complex numbers,
然后告诉小莱把两个复数相乘
you just use the distributive property
你只需用分配率就可以了
what many people learn in school as”FOIL”
许多人在学校里学习过这种小儿科的东西
and you apply this rule that i × i = -1 to simplify things down further.
然后再用i×i=-1法则作进一步的简化
And that’s fine!
这就很好
That totally works in the standard textbook way to
这完全就是介绍四元数的
introduce quaternions is analogous to this:
教科书式方法:
showing the algebraic rules and calling it done
展示一下代数规则 就完事了
But I think something is missing
但我总觉得缺了点什么
If we don’t at least try to show Linus the geometry of complex numbers
因为我们都没有试着向小莱讲述复数的几何意义
and what complex multiplication looks like,
复数乘法又是怎样的
since the problems in math and physics where complex numbers
毕竟复数在数学和物理相关问题上
are shockingly useful, often leverage this spatial intuition.
尤其是在空间直觉方面相当有用
You and I, who understand two dimensions, might think of it like this:
像你和我这样理解二维的人大都是这样想的:
When you multiply two complex numbers, z times w,
当两复数z和w相乘
you can think of z as a sort of function acting on w,
你可以把z当作是作用于w的函数
rotating and stretching it in some way.
使其以某种方式旋转拉伸
I like to think of this by broadening the view
我喜欢从开阔视野和
and asking what does z do to the entire plane.
思考z对整个平面做了什么这两方面来考虑
and you can think of that bird’s-eye view action
你可以这样理解那个鸟瞰的动作
by imagining using one hand to fix the number 0 in place,
想象着用一只手在某处固定住0
and using another hand to drag the point at 1 up to z,
另一只手就把1拖到z处
since anything times 0 is 0 and anything times 1 is itself.
因为任何数乘以0都等于0 任何数乘以1就等于它本身
And in two dimensions,
而在二维空间中
there is one and only one stretching-rotating action on the plane that’ll do this.
平面上能做到这点的有且仅有一种拉伸旋转动作
This is also how I’ll have you thinking about quaternion multiplication later on,
这也是之后让你们思考四元数乘法的方法
where the number on the left acts as a kind of function to the one on the right,
就是左边的数是右边数的函数
and we’ll understand this function by seeing how it acts by transforming space,
我们可以通过观察它是如何变换空间来理解
although instead of rotating 2d space,
它不是二维空间的旋转
it does a sort of double rotation in 4d space.
而是四维空间的双旋转
By the way,
顺便说下
if you want to review thinking about complex numbers as a kind of action,
如果想复习复数作用的话
a good warm-up for this video might be the one I did
可以很好地温习下我做的
on e^πi, explained with introductory group theory
从群论角度理解欧拉公式的视频
Now Linus the Linelander is pretty comfortable with the idea of stretching:
现在线人小莱相当理解拉伸的概念:
that’s what multiplication by real numbers looks like.
实数相乘看起来就是这样的
Maybe it’s a little weird for him to think about stretching in multiple dimensions,
多维拉伸对他来说可能有点奇怪
but it’s not fundamentally different.
但本质上并没有什么不同
The difficult thing to communicate to Linus is rotation:
很难跟小莱沟通交流的是旋转:
specifically focus on the unit circle of the complex plane
需要特别关注的就是复平面上的单位圆
—all the numbers a distance 1 from zero—
所有的数到0的距离都是1
since multiplication by these numbers, corresponds to pure rotation.
因此乘上这些数 就等于纯旋转
How would you explain to Linus the look and the feel of multiplying by these numbers?
你要怎么向小莱解释被这些数字相乘的样子和感受呢?
At first, that might seem impossible.
最开始 可能会觉得不可能
I mean, rotation is just such an intrinsically two-dimensional idea.
旋转本质上就是一个二维的概念
But on the other hand,
但从另一方面来说
rotation involves only one degree of freedom:
旋转仅涉及到一个自由度:
a single number the angle, specifies a given rotation uniquely.
一个代表角度的数字 唯一给定的旋转
So in principle, it should be possible to associate the set of all rotations
所以原则上 是可以把所有的这些旋转集合
to the one-dimensional continuum that is Linus’s world.
映射到一维数轴上 也就是Linus的家
And there are many ways you could do this,
有很多方法可以做到这一点
but the one I’m going to show you
我将展示给你的这一种
is what’s called a stereographic projection
就是所谓的球面投影
It’s a special way to map a circle onto a line,
这种特殊的方法能将圆映射到直线上
or a sphere into a plane,
或将球映射到平面上
or even a 4d hyper sphere into 3d space.
甚至可以将四维超球映射到三维空间
For every point on the unit circle,
对于单位圆上的每一点
draw a line from -1 through that point
从-1到该点画一条线
and wherever it intersects the vertical line through the circle’s center,
这条线与过圆心的垂直线的交点
that’s where the point of the circle gets projected
就是圆上的点投射的位置
So for example,
举个例子
the point at 1 gets projected into the center of the line;
点1映射到直线的中心
the point i actually stays fixed in place, as does -i;
i保持原地不动 -i同理
all of the points on that 90° arc between 1 and i
1和i之间的90°弧上所有的点
will get projected somewhere in the interval between where 1 landed and where i landed.
就被映射到1和i的投射区间
As you continue farther around the circle on the arc between i and -1,
当你沿着i和-1之间的圆弧继续
the projected points end up farther and farther away at an increasing rate.
映射点最终会越来越远 速度也越来越快
Similarly, if you come around the other way towards -1,
同理 如果你从另一个方向靠近-1
the projected points end up farther and farther on the other end of the line.
映射点离直线的另一末端越来越远
This line of projected points is what we show to Linus,
这条映射点所组成线就是我们要向小莱展示的
labeling a few key points like 1 and i and -1, all for reference.
标记几个关键点作为参考 比如1 i -1
Technically, the point at -1 has no projection under this map,
理论上来讲 点-1在此并没有映射点
since the tangent line to the circle at that point never crosses the vertical line,
因为过此点的圆的切线永远不会与纵轴相交
but what we say is that -1 ends up at the”point” at infinity.
但我们说-1最终被映射到了无穷处的某点上
This is a special point you imagine adding to the line where you would approach it,
这是一个特殊的点 你可以想象沿着这条直线的任意一个方向
if you walk infinitely far along the line in either direction.
走到无穷远处就能看见它
Now it’s important to remember and to remind Linus that what he’s seeing is
重要的是要记住并提醒小莱 他所看到的
only the complex numbers that are a distance 1 from the origin: the unit circle.
仅仅是那些距离原点长度为1的复数 也就是单位圆
Linus doesn’t see most numbers
而看不到大部分的复数
like 0 or 1 + i or -2 – i.
比如说0 1 +i -2 -i
But that’s okay,
但还好
because right now we just want to describe complex numbers z
因为现在我们只需要描述复数z
where multiplying by z has the effect of a pure rotation,
那些乘以z就会产生纯旋转的效果
so he only needs to understand the unit circle.
所以他只需要理解单位圆就可以了
For example, when we take the number i
举例来说 当我们用i
and multiply it by any other complex number w,
乘以任意复数w
the effect is to rotate by 90° counterclockwise.
产生的效果就是把w反时针方向旋转90°
And when we apply this action to the circle being projected down to the line for Linus,
当我们把这种作用施加到被映射到小莱直线的圆上时
what does he see?
会看到什么?
Well, it’s a bit of a strange morphing action on the line,
他会看到直线上略显怪异的变形动作
one which I want you to become
我希望你能熟悉这些
familiar with for something we’ll see later on.
稍后我们会讲到
It’s easiest to understand by following a few key reference points.
遵循几个关键的参考点是最容易理解的
i times 1 is i,
i×1=i
so that means the number 1 should move up to i.
这就意味着1应该移到i上
i times i is -1,
i×i=1
so the point at i slides off to infinity.
所以i滑动到无穷处
i times -1 is equal to -i,
i×(-1)=-i
so that point at infinity kind of comes back around from the bottom
所以无穷处的点从最底部的位置
to the position one unit below the center
回到中心下方一个单元的位置
and i times -1 is 1,
i×(-1)=1
so that point at -i slides up to 1.
所以-i滑到1的位置
Even though this is kind of a weird motion,
虽然这是一种奇怪的运动
it lets us communicate some important ideas to Linus.
但能让我们向小莱传达些重要的想法
For example, multiplying by i four times,
比如说 乘以i四次
which corresponds to rotating by 90° four times in a row,
对应连续进行四次的90°旋转
gets us back to where we started: i to the fourth equals one.
就能回到起始点:即i的四次方是1
Here to get more of a feel for things,
此时为了再增加点感觉
let me just show the circle rotated at various different angles,
请允许我展示一下圆旋转不同角度的情况
on both the left and the right half of the screen here,
屏幕左侧和右侧会同时进行
and putting a hand on the point that started at the number 1
把一只手放在从1开始的点上
to help us and to help Linus keep track of the overall motion.
来帮助我们和小莱追踪整体的运动情况
第二章 纸片人小菲
Next, let’s introduce Felix the Flat lander,
接下来 我们介绍下纸片人小菲
who only understands two-dimensional geometry.
他只懂二维几何
Imagine trying to explain rotations of a sphere to Felix.
想象下向小菲解释球体的旋转
In the spirit of transitioning from complex numbers to quaternions,
为了从复数过渡到四元数
let’s extend the complex numbers with its horizontal axis of real numbers
让我们扩展一下复数 给它的实数水平轴
and its vertical axis of imaginary numbers with a third axis,
和虚数垂直轴 加上第三条轴
defined by some newly invented constant j
该轴是由新发明的常数j定义
sitting one unit away from 0, perpendicular to the complex plane.
距离0有1个单位长度且垂直于复平面
Instead of having this new axis in the z direction like you might expect,
而非你们所想象的那样 在z方向新增一轴
for a better analogy with how we’ll visualize quaternions,
目的就是为了更好地与我们如何可视化四元数形成类比
we’ll want to orient things so that
我们要明确方位
the i and the j axes sit in the x and the y directions
使i轴和j轴处于x轴和y轴上
with the real number line aligned along the z direction.
实数轴沿着z轴的方向
So every point in 3d space is described
所以三维空间中的每一个点都可以
as some real number,
表述为某个实数
plus some real number times i, plus some real number times j.
加上某个实数乘以i 再加上某个实数乘以j
As it happens, it’s not possible to define a notion
事实上 我们是不可能
of multiplication for a 3d number system like this
给三维数字系统的乘法运算下个这样的定义
that would satisfy the usual algebraic properties that make multiplication a useful construct.
能满足一般代数的性质 并使之成为一个有用的构造
Perhaps I’ll outline why this is the case in a follow-on video,
也许我会在后续的视频中阐述一下为什么会出现这种情况
but staying focused on our current goal,
现在还是关注下我们眼下的事情
think about describing 3d rotations in this coordinate system to Felix the flatlander.
考虑下向纸片人小菲描述下此坐标系中的三维旋转
The unit sphere consists of
单位球面由
all those numbers which are a distance 1 from 0 at the origin,
所有到原点的距离为1的数组成
meaning the sum of the squares of their coordinates is 1.
也就是说它们坐标的平方和为1
We can’t show all of 3d space to Felix,
我们不能将所有的三维空间都展示给小莱
but what we can do is project this 2d surface to him
但是我们可以把二维曲面投影给他看
and give him a feel for what reorientations
让他感受一下
of the sphere look like under that projection.
现在投影的球体是怎么样的
Analogous to what we did before,
与我们之前所做的类似
stereographic projection will associate almost every point on the unit sphere
球面投影几乎会将单位球面的所有点
with a unique point on the horizontal plane
与由i轴和j轴定义的水平面上
defined by the i and the j axes.
唯一的点联系起来
For each point on the sphere,
对于球面上的每一点来说
draw a line from -1 at the south pole through that point
过南极的-1点做一条直线
and see where it intersects the plane.
求出它与平面的交点
So the point 1 at the north pole ends up at the center of the plane;
北极的点1最终位于平面的中心
all of the points of the northern hemisphere get mapped somewhere
而北半球上的所有点都被映射到
inside the unit circle of the i j plane;
i j平面的单位圆里的某处
and that unit circle which passes through i, j, -i
经过i j -i -j的单位圆上的所有点
and -j actually stays fixed in place.
则保持不动
And that’s an important point to make note of:
还有需要注意的重要一点是:
even though most points and lines and patches that Felix the Flatlander sees
虽然纸片人小莱所看到的几乎所有的点 线 斑块
are going to be warped projections of the real sphere,
都是实体球的扭曲投影
this unit circle is the one thing that he has which is an honest part of our unit sphere,
单位圆是他所看拿到的 也是我们单位球上唯一真实的部分
unaltered by projection
且不随投影而变动
All of the points in the southern hemisphere get projected outside that unit circle,
而所有南半球上的点则被投影到单位圆的外面
each getting farther and farther away as you approach -1 at the south pole.
你越靠近南极的-1点 它们就变得越远
And again, -1 has no projection under this mapping,
同样 -1在这种映射下没有投影点
but what we say is that
但我们说
it ends up at some point at infinity.
它最终会在无穷处的某一点
That point at infinity is something such that
无穷处的某一点也就是说
no matter which direction you walk on the plane,
不管你沿着平面上的哪个方向走
as you go infinitely far out, you’ll be approaching that point.
当你走到无穷远 你就靠近了那一点
It’s analogous to how if you walk any direction away
这就类似于 不管你从北极出发沿着哪个方向走
from the north pole, you’re approaching the south pole.
你都能走到南极
Now let me just pull up a view
现在来打开一个视图
of what Felix sees in two dimensions.
看看小菲在二维空间看到了什么
As I rotate the sphere in various ways,
当我以不同的方式旋转球体
the lines of latitude and longitude drawn on that sphere
球面上画的纬线和经线
get projected into various circles and lines in Felix’s space.
在小菲的空间映射成不同的圆圈和线条
And the way I’ve done things up here,
此时此刻 我所做的就是
the checkerboard pattern on the surface of the sphere is accurately reflected
将球体表面的棋盘图案精准的投射到
in the projected view that you see with Felix,
小菲所看到的的投影视图中
and the pink dot represents where the point that started
粉红色的点表示
at the north pole ends up after the rotation,
起始于北极的点旋转结束后的位置
and that yellow circle represents where
而黄色的圆圈则表示
the Equator ended up after the projection.
投影后赤道的位置
The more you put yourself in Felix’s shoes right now,
现在你越是站在小菲的角度
the easier quaterniums will be in a moment.
一会理解四元数起来就越容易
And as with Linus,
和小莱一样
it helps to focus on a few key reference objects,
专注于几个关键的参考点更有帮助
rather than trying to see the whole sphere.
而非试图理解这个球体
This circle, passing through 1, i, -1, and -i,
过1 i -1 -i四点的圆
gets mapped onto a line which Felix sees as the horizontal axis.
映射到了一条直线上 也就是小菲眼中的水平轴上
It’s important to remind Felix that
重要的是要提醒小菲
what he sees is not the same thing as the i axis.
他所看到的轴和i轴根本不一样
Remember, we’re only projecting the numbers
记住 我们仅仅投影了
that have a distance 1 from the origin,
距离原点长度为1的点
so most points on the actual i axis,
所以 真正i轴上的大多数点
like 0 and 2i and 3i and et cetera,
像0 2i 3i等其他点
are completely invisible to Felix
对小菲来说是完全不可见的
Similarly, the circle that passes through 1, j, -1, and -j
类似的 过1 j -1 -j四点的圆
gets projected onto what he sees as a vertical line.
则映射到小菲眼中的垂直线上
And in general, any line that Felix sees
一般来说 小菲所看到的所有直线都源于
comes from some circle on the sphere that passes through -1.
球面上过-1点的圆
In some sense,
在某种程度上
a line is just a circle that passes through the point at infinity.
直线也仅仅是过无穷处某点的圆
Now think about what Felix sees as we rotate the sphere.
现在来思考一下 当我们旋转球体时小菲会看到什么
A 90° rotation about the j axis brings 1 to i,
绕j轴旋转90° 就把1带到了i
i to -1, -1 to -i, and -i to 1.
i带到了-i -1带到了-i -i带到了1
So what Felix the Flatlander sees
所以纸片人小菲所看到的
is an extension of the rotation that Linus the Linelander was seeing.
就是直线人小莱看到的旋转的扩展
Notice also that this action rotates the i j unit circle
还需要注意的是 该动作将i j单位圆旋转到了
to the position where the 1 j unit circle used to be
1 j单位圆原先所处的位置
So what Felix sees is his yellow unit circle
所以小菲看到的是 他的黄色单位圆
getting transformed into a vertical line,
变成了一条垂直线
while that red vertical line gets transformed into the unit circle.
而红色的垂直线变成了单位圆
Of course, from our perspective,
当然 从我们的角度来看
we know this is all just rigid motion.
我们知道这些都是刚性运动
No actual stretching or more thing is taking place;
并没有发生实际的拉伸或者其他之类的
all of that is just an artifact of the projection.
所有的这些都是投影效果
Similarly a rotation about the i axis involves
类似地 绕i轴旋转就涉及到
moving 1 to j, j to -1,
把1移动到j 把j移动到-1
-1 to -j, and -j to 1.
把-1移动到-j 把-j移动到1
This rotation turns the i j unit circle
该旋转将i j的单位圆
into the 1 -i unit circle,
变成了1 -i的单位圆
which to Felix,
这对小菲来说
looks like the unit circle getting transformed into a horizontal line.
就像是单位圆变成了水平线
A rotation about the real axis
绕实轴旋转
is actually quite easy for Felix to understand
对于小菲来说就相当容易理解了
since the whole projection simply gets rotated about the origin,
因为整个投影只是围绕原点旋转
where the only point staying fixed in place are
唯一保持不动的点就是
1 at the origin and -1 off at infinity.
原点处的1和无穷处的-1
第三章 三维人 你
In the same way that the complex numbers included the real numbers
正如复数包含一个实数
with a single extra quote-unquote”imaginary” dimension represented by the unit i,
和一个额外的用单位i表示的所谓的虚部
and that the not-actually-a-number-system thing we had in three dimensions
而我们在三维空间的并非真正的数字系统
included a second imaginary direction j,
则包含了另一个虚部j
the quaternions include the real numbers together
四元数包括实数
with three separate imaginary dimensions,
以及三个不同的虚部
represented by the units i, j and k.
表示为i j k
Each of these three imaginary dimensions
这三个虚部中的每一个
is perpendicular to the real number line,
都垂直于实数轴
and they’re all perpendicular to each other somehow.
而且它们都互相垂直
So in the same way that complex numbers are represented
因此正如复数可以表示为
as a pair of real numbers,
一对实数
each quaternion can be written using four real numbers,
每个四元数都可以用四个实数来表示
and it lives in four-dimensional space.
且存在于四维空间之中
You often think of this as being broken up into a real or”scalar” part
你也可以把它想象成被分解的实部 抑或是“标量”部分
and then a 3d imaginary part.
以及一个三维的虚部
And Hamilton used a special word
哈密顿用了一个特殊的词来形容
for quaternions that had no real part and just i j k components,
没有实部只有i j k三个虚部的四元数
a word which was previously somewhat foreign in the lingo of math and physics:”vector”.
一个先前在数学和物理术语中从未涉及过的词汇 也就是“向量”
On the one hand, you could just define quaternion multiplication by
一方面 你可以这样定义四元数乘法
giving the rules for how i, j,and k multiply together
给出i j k相乘的规则
and saying that everything must distribute nicely.
规定它们必须很好地满足分配率
This is analogous to defining complex multiplication by saying
这就好比定义复数乘法
that i times i is -1,
i×i=-1
and then distributing and simplifying products.
然后再用分配率并简化结果
And indeed, this is how you would
事实上 这就是
tell a computer to perform quaternion multiplication,
教计算机执行四元数乘法的方法
and the relative compactness of this operation compared to say matrix multiplication,
相对于矩阵乘法 这种操作方法的简洁性在于
is what’s made quaternions so useful for graphics programming and many other things.
它使四元数在图形编程和其他方面很实用
There’s also a rather elegant form of this multiplication rule written
这也是一种相当优雅的
in terms of the dot product and the cross product,
以点积和叉乘来描述四元数乘法法则的方式
and in some sense, quaternion multiplication subsumes both of these notions—
从某种意义上来讲 四元数乘法涵盖了这两个概念
at least as they appear in three dimensions.
至少三维空间中使这样的
But just as a deeper understanding
但正如更深层次的理解复数
for complex multiplication comes from understanding its geometry,
就要理解它的几何意义一样
that multiplying by a complex number
被复数相乘
involves a combination of scaling and rotating,
就包括了缩放和旋转两个概念
you and I are here for the four-dimensional geometry of quaternion multiplication.
你和我在这里就要弄明白四元数乘法的四维几何意义
And just as the magnitude of a complex number, its distance from zero,
就像复数的大小一样 它到0的距离
is the square root of the sum of the squares of its component,
就是它的实数和虚数的平方和的平方根
that same operation gives you the magnitude of a quaternion.
这样的操作方法也适用于四元数
And multiplying quaternion q1 by another q2,
四元数q1乘以另一个四元数q2
has the effect of scaling q2 by the magnitude of q1
就会把q2以q1的大小缩放
followed by a very special type of rotation in four dimensions.
接着就是一种非常特殊的四维旋转
And those special 4d rotations,
这些特殊的四维旋转
the heart of what we need to understand,
就是我们需要理解的核心内容
correspond to the hypersphere of quaternions a distance 1 from the origin,
与此对应的则是距离原点为1的四元数超球面
both in the sense
不仅仅是
that the quaternions whose multiplying action is a pure rotation live on that hyper sphere,
就四元数乘法是超球面上单纯的旋转而言
and in the sense
还有就是
that we can understand this weird 4d action just by following points on the hypersphere,
我们可以通过超球面上的这些点来理解这种奇怪的四维作用
rather than trying to look at all of the points
而非试图明白
in the inconceivable stretch as a four-dimensional space.
四维空间中所有这些点不可思议地伸展
Analogous to what we did for Linus and Felix,
与我们对小莱和小菲所做的类似
we stereographically project this hypersphere into 3d space
我们把超球面的球面投影到三维空间
This label in the upper right
右上角的这个标签
is going to show a given unit quaternion,
显示了一个给定的单位四元数
and this little pink dot will show where
而这个粉红色的小点将会展示出
that particular quaternion gets projected in our 3d space.
那个特定的四元数被投射到三维空间的哪个位置
Just as before, we’re projecting from the number -1,
和之前一样 我们还从-1点开始投影
which sits on the real number line that is somehow perpendicular to
-1位于实数轴 并且以某种方式垂直于
all of our 3d space and beyond our perception.
我们所有的三维空间 这远远超出我们的认知
Just as before, the number 1 ends up projected straight
和之前一样 1最终被投影在
into the center of our space,
我们空间的正中央
and in the same way that i and -i were fixed in place for Linus,
正如i和-i在小莱的空间保持不变
and that the i j unit circle was fixed in place for Felix,
以及i j单位圆在小菲的空间保持不变一样
we get a whole sphere passing through i, j and k
我们得到了一个穿过单位超球面上i j k的完整球体
on that unit hypersphere which stays in place under the projection.
它在这种投影下也保持不变
So what we see as a unit sphere in our 3d space
所以在三维空间 我们眼中的单位球
represents the only unaltered part of the hypersphere
代表着四元数投射到我们空间时
of quaternions getting projected down on to us.
唯一保持不变的那部分
It’s something analogous to the equator of a 3d sphere,
类似于三维球体的赤道
and it represents all of the unit quaternions whose real part is 0.
它代表着所有实部为0的单位四元数
What Hamilton would have described as unit vectors.
哈密顿后来描述为单位向量
The unit quaternions with positive real parts between 0 and 1
那些处在0和1之间的有着正实部的单位四元数
end up somewhere inside this unit sphere
最终投影到单位圆的内部
closer to the number 1 in our 3d space,
靠近我们三维空间中的1的地方
which should feel analogous to how the northern hemisphere got mapped
这感觉有点类似于小菲空间中
inside the unit circle for Felix.
北半球被映射到了单位圆的内部
On the other hand, all the unit quaternions with negative real part
另一方面 所有有着负实部的单位四元数
end up somewhere outside that unit sphere.
最终被映射到单位圆的外部某个地方
The number -1 is sitting off at the point at infinity,
而-1则位于无穷远处的某个地方
which you can easily find by walking in any direction.
沿着任意方向你都能轻松找到它
Keep in mind, even though we see the projection
要记住 尽管我们看到的
of some of these quaternions as being closer or farther
这些四元数的投影
from the origin of our 3d space,
离我们三维空间的原点或近或远
everything you’re looking at represents a unit quaternion,
但你所看到的每一个都代表着一个单位四元数
so everything you’re looking at really has the same magnitude:
因此目之所及 所有四元数都有着同样的大小:
the same distance from the number 0.
即到0的距离相同
And that number 0 itself is nowhere to be found in this picture.
而0却不在此显现
Like all other non-unit quaternions, It’s invisible to us.
和其他所有的非单位四元数一样 它对我们来说是不可见的
In the same way that, for Felix, the circle passing through 1, i, -1 and -i
正如对小菲来说 过点1 i -1 i的圆
got projected into a line through the origin,
被映射到一条过原点的直线上
when we see this line through the origin passing through i and -i
当我们看到过原点 i -i的直线时
we should understand that it really represents a circle.
我们要知道它实际上代表着一个圆
Likewise, up on the hypersphere invisible to us,
同样地 在我们看不到的超球面上
there is a unit sphere
也有一个单位球
passing through 1, i, j, -1, -i, and -j,
通过1 i j -1 -i -j
and that whole sphere gets projected into the plane that
而整个球体则被投影到一个平面上
we see passing through 1, i, -i, j,
我们可以看到该平面通过了1 i -i j
-j, and -1 off at infinity:
-j以及无穷远处的-1
what you and I might call the xy plane.
我们把此平面称之为xy平面
In general, any plane that you see here
一般来说 你在此看到的所有平面
really represents the projection of a sphere
都代表着超球面上
somewhere up on the hypersphere which passes through the number -1.
某个球面的投影 该球面过-1
Now the action of taking a unit quaternion
现在取一个单位四元数
and multiplying it by any other quaternion from the left
然后将它乘以左边的任何其他四元数
can be thought of in terms of two separate 2d rotations
你也可以将这理解为两个单独的二维旋转
happening perpendicular to and in sync with each other
它们相互垂直且同步发生
in a way that could only ever be possible in four dimensions.
并通过四维空间中仅有的方式实现
As a first example, let’s look at multiplication by i.
第一个例子 我们就来看一下i的乘法运算
We already know what this does to the circle that passes through 1 and i,
我们已经知道过1和i的圆乘以i会发生什么
which we see as a line.
我们把它看成一条直线
1 goes to i,
1到i
i goes to -1 off at infinity,
i到无穷远处的-1
-1 comes back around to -i, and -i goes to 1.
-1回到-i -i 回到1
Remember, just like what Linus saw,
记住 就像小莱所看到的那样
all of this is the stereographic projection of a 90° rotation.
所有的这些都是90°旋转的球面投影
Now look at the circle passing through j k,
现在看这个过j和k的圆
which is in a sense perpendicular to the circle passing through 1 and i.
在某种意义上它垂直于过1和i的圆
Now, it might feel weird to talk about
现在我们说这两个圆互相垂直
two circles being perpendicular to each other,
可能有点奇怪
especially when they have the same center, the same radius,
特别是它们的圆心相同 半径相同
and they don’t touch each other at all,
而且它们完全相离
but nothing could be more natural in four dimensions.
但在四维空间中这是最正常不过了
You can think of the action of i
你可以理解为
on this perpendicular circle as obeying a certain right-hand rule.
i在这个垂直圆上的作用遵循某个右手定则
If you’ll excuse the intrusion
很抱歉
of my ghostly green screen hand into our otherwise pristine platonic mathematical stage,
让我幽灵般的绿手入侵了我们原本纯洁的理想中的数学空间
you let that thumb of your right hand point from the number 1 to i,
将右手拇指从1指到i
and you curl your fingers.
再将其他四指蜷起来
The j k circle will rotate in the direction of that curl.
过j k的圆将会沿着你手指蜷起来的方向旋转
How much? Well, by the same amount as the 1-i circle rotates,
旋转多少呢?和过1 -i的圆旋转角度相同
which is 90° in this case.
也就是案例中的90°
This is what I meant by two rotations perpendicular to
这就是之前所说的两个互相垂直
and in sync with each other.
且彼此同步的旋转
So j goes to k,
所以j到了k
k goes to -j,
k到了-j
-j goes to -k,
-j到了-k
and -k goes to j.
-k到了j
This gives us a little table
这里有个小表格
for what the number i does to the other quaternions.
显示了i对其他四元数做了什么
But I want this not to be something that you memorize,
但我并不希望你死记硬背
but something that you could close your eyes and you could really see.
而是希望你闭上眼 就能在眼前刻画出来
Computationally, if you know what a quaternion does to
从计算上来讲 如果你知道四元数
the numbers 1, i, j, k,
对1 i j k做了什么
you know what it does to any arbitrary quaternion,
你就知道了它会对任意四元数做了什么
since multiplication distributes nicely.
因为四元数满足乘法分配律
In the language of linear algebra 1, i, j, k
用线性代数的话来说就是 1 i j和k
form a basis of our four dimensional space,
形成了我们四维空间的基底
so knowing what our transformation does to them
所以知道了这种变幻对它们的作用效果
gives us the full information about what it does to all of space.
我们就完全掌握了这种变幻对所有空间的作用效果
Geometrically, a four-dimensional creature would be able to
几何学上 一个四维生物能够
look at those two perpendicular rotations that I just described
看见我刚才所描述的那两个互相垂直的旋转
and understand that they lock you into one and only one rigid motion for the hypersphere.
并理解它们有且仅有一个超球面的刚性运动
We might lack the intuitions of such a hypothetical creature,
我们可能缺乏这种四维生物的直觉
but we can maybe try to get close.
但我们可以试着向它靠拢
Here’s what the action of repeatedly multiplying by i looks like
这是在i j k球体上的球面投影上
on our stereographic projection of the i j k sphere.
被i重复相乘之后产生的作用效果
It gets rotated into what we see as a plane,
它旋转到我们所看到的平面上
then gets rotated further back to where it used to be (though the orientation is all reversed now),
然后再旋转到原来的位置(虽然是现在完全反过来的)
then it gets rotated again into what we see as a plane,
然后再旋转到我们看到的那个平面上
and after the fourth iteration it ends up right back where it started.
反复经过四次 它最终返回到起始位置
As another example, think of a quaternion like
再举个例子 思考下四元数比如说
q equals negative square root of 2 over 2 plus square root of 2 over 2 times i
q = -(√2)/2 + (√2)/2 i
which if we pull up a picture of a complex plane
如果我们展开这个复平面的图示
is a 135° rotation away from 1 in the direction of i.
它就是i方向上从1开始的一个135°旋转
Under our projection, we see this along the line
在此投影中 我们沿着
from 1 to i somewhere outside the unit sphere.
从1到i的线在单位球外部某处找到它
If that sounds weird,
如果听起来觉得怪怪的
just remember how Linus would have seen the same number.
就记住小莱是怎么看的
The action of multiplying this q by all other quaternions will look to us
将这个q乘以所有其他四元数 对我们来说
like dragging the point at 1 all the way to this projected version of q,
看起来就像是把点1一直拖拽到q的投影
while the j k circle gets rotated 135° according to our right-hand rule.
同时j k的圆则根据右手法则旋转135°
Multiplication by any other quaternion is completely similar.
与其他任何四元数相乘也是如此 完全一样
For example, let’s see what it looks like
比如说 我们来看下
for j to act on other quaternions by multiplication from the left.
j通过左边相乘其他四元数会怎样
The circle through 1 and j,
过1和j的圆
which we see projected as a line through the origin,
在我们眼中 它的投影是一条过原点的直线
gets rotated 90°, dragging 1 up to j.
旋转90°后 就把1拖拽到了j
So j times 1 is 1, and j times j is -1.
所以j×i=1 j×j=-1
The circle perpendicular to that one, passing through i and k,
垂直于它的 过i和k的圆
gets rotated 90° according to this right-hand rule,
根据右手法则旋转90°
where you point your thumb from 1 to j.
此时你的大拇指就从1到j
So j times i is -k,
因此j×i=-k
and j times k is i.
j×k=1
In general, for any other unit quaternion you see somewhere in space,
目之所及 空间中的所有单位四元数
start by drawing the unit circle passing through 1, q, and -1,
首先画出经过1 q -1的单位圆
which we see in our projection as a line through the origin,
我们所看到的它的投影是一条过原点的直线
then draw the circle perpendicular to that one
然后再画一个垂直于它的单位圆
on what we see as the unit sphere.
也就是我们眼中的单位球
You rotate the first circle
旋转第一个圆
so that 1 ends up where q was,
使1最终来到q的位置
and rotate the perpendicular circle by the same amount,
然后根据右手法则
according to the right hand rule.
将垂直的圆旋转相同的角度
One thing worth noticing here is that order of multiplication matters:
此时值得注意的一点是相乘的顺序至关重要:
it’s not, as mathematicians would say, commutative.
用数学家的话说就是 不满足交换律
For example, i times j is k,
举个例子 i×j=k
which you might think of in terms of i acting on
你可能会认为是
the quaternion j, rotating it up to k.
i作用于四元数j 将它旋转到k
But if you think of j as acting on i,
但如果你认为是j作用于i
j times i, it rotates i to -k.
j×i 就会把i旋转到-k
In fact, commutativity—this ability to swap the order of multiplication—
其实 交换律即交换相乘顺序的能力
is a way more special property than a lot of people realize,
是一种比我们想象中还要特殊的一种性质
and most groups of actions on some space don’t have it.
某些空间上的大多数作用都并未涉及到它
It’s like how in solving a Rubik’s cube, order matters a lot,
这就好比是解魔方 顺序很重要
Or how rotating a cube about the z axis and then about the x axis
亦或是先绕z轴再绕x轴旋转魔方
gives a different final state from rotating it
跟先绕x轴再绕z轴旋转魔方
about the x axis, then about the z axis.
最终得到的完全不一样
And last, as one final but rather important point,
最后 压轴的一点
so far I’ve shown you how to think about quaternions
目前我已经向你展示了如何理解
as acting by left multiplication,
四元数的左乘作用
where when you read an expression like i times j,
就是当你看到像i乘以j这样的表达式时
you think of i as a kind of function morphing all of space
你要把i当作是一个变形了整个空间的函数
and j is just one of the points that it’s acting on.
j只是它的作用点之一
But you can also think of them as a different sort of action
但是从右乘的角度看 你也可以它们看作是
by multiplying from the right,
另外一种不同的作用
where in this expression, j would be acting on i.
在这个表达式中 j作用于i
In that case, the rule for multiplication is very similar.
这种情况下 乘法法则就十分相似
It’s still the case that 1 goes to j and j goes to -1, etc.
依旧是1到j j到-1 等等
But instead of applying the right-hand rule to the circle perpendicular to the 1-j circle,
但不能对1-j圆的垂直圆用右手法则
you would use your left hand.
要用左手
So either way, i times j is equal to k,
所以不管怎么样 i×j=k
but you can either think about this with your right hand
但你可以这样想
curling the number j to the number k
右手从j到k的顺序蜷起来
as your thumb points from 1 to i,
大拇指从1指向i
or as your left hand curling i to k
或者左手按i到k的顺序蜷起来
as its thumb points from 1 to j.
大拇指则由1指向j
Understanding this left hand rule for multiplication from the other side
从另一方面理解这种左手乘法法则
will be extremely useful for understanding
非常有助于理解
how unit quaternions describe rotation in three dimensions.
如何用单元四元数描述三维旋转
And so far,
目前为止
it’s probably not clear how exactly quaternions do describe 3d rotation.
还不是很清楚到底如何用四元数描述三维旋转
I mean, if you consider one of these actions
我的意思是 如果你考虑
on the unit sphere passing through i, j, and k,
经过i j k的单位球面上的一种作用
it doesn’t leave that sphere in place, it morphs it out of position.
球体没有停留在原地 而是被变换出来了
So the way that this works is slightly more complicated than a single quaternion product.
所以这个过程比四元数乘法还要复杂些
It involves a process called conjugation,
它涉及到了共轭
and I’ll make a full follow-on video all about it
我会做一个完整的后续视频
so that we have the time to go through some examples
以便我们能有时间讲解例子
In the meantime, for more information on the story of quaternions
同时 如果你想了解更多四元数的故事
and their relation to orientation in 3d space,
以及它们与三维空间方向的关系
Quanta, a mathematical publication
Quanta 这个数学刊物
I’m sure a lot of you are familiar with,
相信你们不少人都很熟悉
just put out a post in a kind of loose conjunction with this video. (link in the description)
刚发了一个与这个视频多少有点关联的帖子(链接在视频简介里)
If you enjoyed this, consider sharing it with some friends,
如果你喜欢 记得和朋友们分享下
and if you felt like the narrative structure here was actually helpful for understanding
如果你觉得本期视频中采取得叙事结构方式有助于理解
maybe reassure those friends who would be turned off by a large timestamp
记得告诉你的朋友让他们放心 不要被进度条吓到
that good math is actually worth the time.
毕竟如此优秀的数学是值得花时间学习的
And many thanks to the patrons among you.
多谢你们的打赏
I actually spent way longer than I care to admit on this project,
我在这个视频上花费的时间比预计的还要久
so your patience and support is especially appreciated this time around.
所以这一次你们的耐心和支持真的很赞 非常感谢

发表评论

译制信息
视频概述

四元数是什么?四元数乘法又是怎样的?我们又该如何将四元数可视化呢?看看直线人小莱,纸片人小菲,还有你这个三维人怎么说吧

听录译者

收集自网络

翻译译者

长安小盆友

审核员

审核员1024

视频来源

https://www.youtube.com/watch?v=d4EgbgTm0Bg

相关推荐