史上最重要的算法:快速傅里叶变换如何影响世界 veritasium 2022-11-03

快速傅里叶变换:无处不在的幕后英雄

这是一个关于快速傅里叶变换(Fast Fourier Transform, FFT: 一种用于将信号分解为不同频率的正弦波的算法,显著提高了傅里叶变换的计算效率)的视频,它被誉为史上最重要的算法。

View/Hide Original English

This is a video about the most important algorithm of all time, the Fast Fourier Transform or FFT.

我们无时无刻不在使用它,包括你现在观看这个视频的时候,它也应用于雷达、声纳、5G和WiFi等领域。

View/Hide Original English

I mean, you use it all the time including right now to watch this video and it's used in radar and sonar, 5G and WiFi.

基本上,任何时候进行信号处理,都很有可能涉及快速傅里叶变换

View/Hide Original English

Basically, anytime a signal is processed, there's a good chance that a Fast Fourier Transform is involved.

但除此之外,快速傅里叶变换是由科学家们在试图探测秘密核武器试验时发现的。

View/Hide Original English

But on top of all this, the FFT was discovered by scientists trying to detect covert nuclear weapons tests.

如果他们能更早发现它,也许就能阻止核军备竞赛。

View/Hide Original English

And if they had discovered it sooner, it may have put a stop to the nuclear arms race.

我一直以为核军备竞赛是不可避免的,一旦美国在日本广岛和长崎投下原子弹(atomic bombs: 利用核裂变原理释放巨大能量的武器),其他所有主要大国发展核武器就只是时间问题。

View/Hide Original English

You know I always assumed that the nuclear arms race was inevitable, that once the U.S. dropped atomic bombs on Hiroshima and Nagasaki, it was just unavoidable that all the other major powers would develop nukes.

但也许并非如此,因为所有人都清楚核武器是颠覆性的。

View/Hide Original English

But maybe it wasn't because it was clear to everyone that nuclear weapons were game changing.

投在广岛的炸弹释放的能量比最大的常规炸药多一千倍,因此其他国家理所当然地感到担忧。

View/Hide Original English

The bomb dropped on Hiroshima released a thousand times more energy than the biggest conventional explosive so other countries were rightfully concerned.

战争结束时,加拿大和英国要求召开会议讨论核武器问题。

View/Hide Original English

At the end of the war, Canada and the U.K. requested a meeting to discuss what would be done about nuclear weapons.

与我预期的相反,美国实际上对这些讨论持开放态度。

View/Hide Original English

And contrary to what I expected, the U.S. was actually open to these discussions.

他们意识到自己不会是唯一拥有核武器的国家。

View/Hide Original English

They realized that they wouldn't be the only nation with nukes for long.

因此,他们提出如果其他国家承诺永不制造核武器,他们将销毁所有核武器。

View/Hide Original English

So they offered to decommission all their nuclear weapons if other nations would pledge never to make them.

这就是所谓的巴鲁克计划(Baruch plan: 美国在二战后提出的核武器控制方案,提议由国际机构控制所有放射性材料,以防止核武器扩散),它建议由一个国际机构控制地球上所有放射性材料,从开采到提炼,再到将这些材料用于核能发电等和平目的。

View/Hide Original English

This was known as the Baruch plan and it proposed that an international body would control all radioactive materials on earth, from mining to refining to using these materials for peaceful purposes as a nuclear power generation.

但苏联拒绝了这项提议。

View/Hide Original English

But the Soviets rejected the proposal.

他们认为这只是美国维持核优势的又一个策略,于是全球核军备竞赛开始了。

View/Hide Original English

They saw it as just another ploy to maintain American nuclear dominance and so the global nuclear arms race began.

核试验的危害与公众抗议

开发新的核武器需要进行广泛的试验,其中大部分是在北极或南太平洋岛屿等偏远地区进行的。

View/Hide Original English

To develop new nuclear weapons required extensive testing and most of it was done in remote places like the Arctic or the South Pacific Islands.

美国还在内华达州设立了一个核试验场,其放射性产物随风飘散到全国各地,因此除了日本之外,受美国核武器影响最严重的人是美国人自己。

View/Hide Original English

The U.S. also created a nuclear testing site in Nevada, the radioactive products of which blew across the country so that outside of Japan, the people most adversely affected by American nuclear weapons were Americans themselves.

美国很快从裂变(fission: 重原子核分裂成较轻原子核并释放能量的过程)武器发展到热核炸弹(thermonuclear bombs: 结合核裂变和核聚变原理,释放比原子弹更大能量的武器,也称氢弹),后者结合了裂变和聚变(fusion: 轻原子核结合成较重原子核并释放能量的过程),释放出更多的能量。

View/Hide Original English

The U.S. soon graduated from fission weapons to thermonuclear bombs which combined fission and fusion to release even more energy.

它们是继第一批原子弹之后又一次巨大的飞跃,其威力比常规炸药又强大了一千倍。

View/Hide Original English

They were as big leap from the first atomic bombs as those devices were from conventional explosives, a thousand times again more powerful.

  • 任何地球生命的毁灭都已成为技术上的可能。
View/Hide Original English

- Annihilation of any life on earth has being brought within the range of technical possibility.

1954年,在南太平洋的比基尼环礁(Bikini Atoll: 太平洋中一个环礁,曾是美国核试验场),美国测试了一种使用锂氘(lithium deuteride: 一种核聚变燃料,用于热核炸弹)作为燃料的新型热核设计。

View/Hide Original English

In 1954 at Bikini Atoll in the South Pacific, the U.S. tested a new thermonuclear design that used lithium deuteride as a fuel

他们预计代号为“虾”(Shrimp)的装置将释放相当于六百万吨TNT的能量,但他们错了。

View/Hide Original English

and they expected the device code named Shrimp to release the energy equivalent of six million tons of TNT but they were wrong.

(炸弹爆炸声)由于与锂-7发生意外反应,它释放的能量是预期的两倍半。

View/Hide Original English

(bomb blasts) It released two and a half times that due to unanticipated reactions with lithium-7.

结果,产生了更多的放射性物质,并以放射性尘埃的形式降落到比计划大得多的区域。

View/Hide Original English

And as a result, more radioactive material was created and it rained down over a much larger area than planned.

邻近环礁的居民在三天后才被疏散,并患上了放射病。

View/Hide Original English

Residents of neighboring atolls were only evacuated three days later suffering from radiation sickness.

更东边,一艘日本渔船上的23名船员被卷入了一场放射性白色灰烬的暴风雪中。

View/Hide Original English

And further east, the 23 crew of a Japanese fishing boat were caught in a flurry of radioactive white ash.

到那天晚上,他们都患上了急性放射综合征(acute radiation syndrome: 暴露于高剂量电离辐射后数小时至数周内出现的一系列症状)。

View/Hide Original English

And by that evening, they were suffering from acute radiation syndrome.

其中一名船员在六个月后死于随之而来的并发症。

View/Hide Original English

One of the crew died from ensuing complications six months later.

  • 记者:由于暴露于放射性尘埃而导致的长期疾病。
View/Hide Original English

- [Reporter] As a result of the extended illness brought about by his exposure to the radiation fallout.

这些事件引发了公众对核试验的强烈抗议。

View/Hide Original English

These events triggered public outcry against nuclear testing.

现代的和平符号(peace sign: 1950年代设计,结合了“核裁军”英文缩写N和D的旗语字母)是在1950年代设计的,它结合了代表核裁军(nuclear disarmament)的旗语字母N和D。

View/Hide Original English

The modern peace sign was designed in the 1950s by combining the semaphore letters for N and D standing for nuclear disarmament.

一些世界领导人呼吁全面禁止核试验,即任何国家都不得再进行核武器试验,这一呼吁实际上受到了世界核大国的认真对待。

View/Hide Original English

A number of world leaders called for a comprehensive test ban, no more testing of nuclear weapons by any state and this call was actually taken seriously by the world's nuclear powers.

他们参加了谈判会议,这些会议的名字非常直白,比如1958年在日内瓦举行的“停止核武器试验会议”。

View/Hide Original English

They entered into negotiations at meetings with very literal names like the Conference on the Discontinuance of Nuclear Weapon Tests held in Geneva in 1958.

为了表明他们的认真态度,他们甚至在谈判期间停止了所有试验,这就是为什么1959年是漫长时期中唯一没有核武器爆炸的一年。

View/Hide Original English

And to show just how serious they were, they even stopped all testing during the negotiations which is why 1959 is the only year in a long stretch when no nuclear weapons were detonated.

全面禁试条约的困境与检测难题

但谈判一项全面禁试条约存在一个大问题,那就是你如何知道对方会遵守协议?

View/Hide Original English

But there was a big problem with negotiating a comprehensive test ban which is how do you know that the other side will hold up their end of the bargain?

美国担心苏联会继续秘密试验并在技术上超越他们,而苏联也同样不信任美国。

View/Hide Original English

The U.S. worried that the Soviets would continue testing covertly and leapfrog them technologically and the Soviets similarly distrusted the U.S..

为了解决这些担忧,他们召开了“专家会议,研究探测可能暂停核试验协议违规行为的可能性”。

View/Hide Original English

So to address these concerns, they convened the Conference of Experts to Study the Possibility of Detecting Violations of a Possible Agreement on Suspension of Nuclear Tests.

说真的,这就是会议的名字,我没有编造。

View/Hide Original English

Seriously, that was the name, I am not making this up.

现在,探测大气层试验相当简单。

View/Hide Original English

Now detecting atmospheric tests was fairly straightforward.

它们产生的放射性同位素会扩散到大气中,可以在数千公里外被探测到。

View/Hide Original English

The radioactive isotopes they produced disperse in the atmosphere and can be detected thousands of kilometers away.

水下试验会产生独特的声音,这些声音在海面下一公里左右的深度高效传播,可以被水听器(hydrophones: 用于在水下检测和记录声音的麦克风)接收。

View/Hide Original English

Underwater tests produce distinctive sounds that travel efficiently around a kilometer below the surface of the ocean and these can be picked up by hydrophones.

但地下试验很难从远处探测,因为它们的辐射大部分被 containment 了。

View/Hide Original English

But underground tests are much harder to detect from afar because their radiation is mostly contained

而且苏联拒绝允许现场合规检查,他们认为那是间谍行为。

View/Hide Original English

and the Soviets refused to allow onsite compliance visits which they regarded as espionage.

这最终导致1963年签署的禁试条约只是一个部分禁令。

View/Hide Original English

And this is ultimately why when a test ban treaty was signed in 1963, it was only a partial ban.

它禁止在水下、大气层和外太空进行试验,这些地方的合规性可以验证,但它没有禁止地下试验,原因很简单,就是几乎不可能验证合规性。

View/Hide Original English

It banned testing underwater, in the atmosphere and in space, places where compliance could be verified, but it didn't ban testing underground for the simple reason that it was almost impossible to verify compliance.

但科学家们一直在努力寻找一种可靠探测地下核爆炸的方法。

View/Hide Original English

But scientists had been trying to find a way to reliably detect underground detonations.

日内瓦会议后,美国和苏联科学家成立了一个工作组讨论这个问题。

View/Hide Original English

Following the Geneva meeting, American and Soviet scientists formed a working group to discuss the issue

他们的想法是使用位于核试验国境外的地震仪(seismometers: 用于检测和记录地面运动的仪器,如地震或爆炸引起的振动)来探测爆炸引起的微弱地面振动。

View/Hide Original English

and their idea was to use seismometers located outside the countries where nukes were being tested to detect the faint ground vibrations caused by explosions.

区分核爆与地震:傅里叶变换的必要性

问题是如何区分核试验和地震?

View/Hide Original English

The problem was how do you distinguish a nuclear test from an earthquake?

每天,世界各地有近300次三级或以上的地震。

View/Hide Original English

Every day around the world, there are close to 300 earthquakes with a magnitude of three or greater.

此外,探测对手试验的目的之一是监视他们,了解他们能制造多大的爆炸。

View/Hide Original English

In addition, part of the purpose of detecting your adversaries tests is to spy on them, to know how big of an explosion they can make.

但地震仪信号不仅取决于装置的当量,还取决于其埋藏的深度。

View/Hide Original English

But the seismometer signal depends not only on the yield of the device but also on how deep it was buried.

对于相同的当量,埋藏越深的爆炸看起来越小。

View/Hide Original English

For a given yield, deeper explosions appear smaller.

因此,科学家们需要一种方法来可靠地确定给定信号是炸弹还是地震,如果是炸弹,它有多大,埋藏有多深。

View/Hide Original English

So scientists wanted a method to reliably determine whether a given signal was a bomb or an earthquake and if it was a bomb, how big it was and how deep it was buried.

他们知道所有这些信息都包含在地震仪信号中,但不能仅仅通过观察波形来读取。

View/Hide Original English

They knew that all this information was contained in the seismometer signal but it couldn't just be read off by looking at the squiggles.

他们需要知道不同频率(frequency: 单位时间内波或振荡重复的次数)的成分有多少,这意味着他们需要进行傅里叶变换(Fourier transform: 一种将信号从时域转换到频域的数学工具,揭示信号中包含的频率成分)。

View/Hide Original English

They needed to know how much of different frequencies were present which meant they needed to take a Fourier transform.

傅里叶变换是一种将信号分解为纯正弦波(sine waves: 一种周期性振荡的波形,傅里叶变换的基本组成部分)的方法,每个正弦波都有自己的振幅(amplitude: 波或振荡的最大位移或强度)和频率,它们叠加起来构成原始信号。

View/Hide Original English

A Fourier transform is a way of decomposing a signal into pure sine waves, each with its own amplitude and frequency that add to make it up.

这看起来有点像魔术,因为一组正弦波的总和可以看起来任意复杂,与其组成部分完全不同。

View/Hide Original English

This seems a bit like magic since the sum of a set of sine waves can look arbitrarily complicated and nothing like its component parts.

有一些优雅的方法可以理解傅里叶变换的工作原理,在此向3Blue1Brown的精彩视频致敬。

View/Hide Original English

There are some elegant ways to understand how Fourier transforms work, shout out to the awesome video by 3Blue1Brown.

但我想采取一种更“暴力”的方法。

View/Hide Original English

But I wanna take more of a brute force approach.

如果你想知道信号中包含多少特定正弦波,只需将信号在每个点乘以该正弦波,然后将曲线下的面积相加。

View/Hide Original English

If you wanna know how much of a particular sine wave is in a signal, just multiply the signal by the sine wave at each point and then add up the area under the curve.

举一个简单的例子,假设我们的信号只是一个具有特定频率的正弦波,但我们假装不知道,并且我们正在试图找出哪些正弦波叠加起来构成它。

View/Hide Original English

As a simple example, say our signal is just a sine wave with a certain frequency but pretend we don't know that and we're trying to figure out which sine waves add to make it up.

如果你将这个信号乘以一个任意频率的正弦波,这两个波是不相关的。

View/Hide Original English

Well, if you multiply this signal by a sine wave of an arbitrary frequency, the two waves are uncorrelated.

你找到它们符号相同(都为正或都为负)的地方与符号相反的地方的可能性一样大,因此当你将它们相乘时,x轴上方的面积等于x轴下方的面积。

View/Hide Original English

You're just as likely to find places where they have the same sign, both positive or both negative as where they have opposite signs and therefore when you multiply them together, the area above the x-axis is equal to the area below the x-axis.

所以这些面积相加为零,这意味着该频率的正弦波不是你信号的一部分。

View/Hide Original English

So these areas add up to zero which means that frequency sine wave is not a part of your signal

假设你在足够长的时间范围内观察,这对于几乎所有你可能尝试的频率都是成立的。

View/Hide Original English

and this will be true for almost all frequencies you could try assuming you're looking over a long enough timeframe.

唯一的例外是,如果正弦波的频率与信号的频率完全匹配,那么这些波是相关的,它们的乘积总是正的,曲线下的面积也是正的,这表明这个正弦波是我们信号的一部分。

View/Hide Original English

The only exception is if the frequency of the sine wave exactly matches that of the signal, now these waves are correlated so their product is always positive and so is the area under the curve that indicates that this sine wave is part of our signal.

即使信号由许多不同频率组成,这个技巧也有效。

View/Hide Original English

And this trick works even if the signal is composed of a bunch of different frequencies.

如果正弦波的频率是信号的组成部分之一,它将与信号相关联,产生一个非零面积。

View/Hide Original English

If the sine waves frequency is one of the components of the signal it will correlate with the signal producing a non-zero area.

这个面积的大小告诉你该频率正弦波在信号中的相对振幅。

View/Hide Original English

And the size of this area tells you the relative amplitude of that frequency sine wave in the signal.

对所有频率的正弦波重复这个过程,你就会得到频率谱。

View/Hide Original English

Repeat this process for all frequencies of sine waves and you get the frequency spectrum.

本质上,就是哪些频率存在以及它们的比例。

View/Hide Original English

Essentially which frequencies are present and in what proportions.

到目前为止,我只谈到了正弦波,但如果信号是余弦波,那么即使你将它乘以一个频率完全相同的正弦波,曲线下的面积也将为零。

View/Hide Original English

Now so far I've only talked about sine waves but if the signal is a cosine wave, then even if you multiply it by a sine wave of the exact same frequency, the area under the curve will be zero.

所以对于每个频率,我们实际上需要乘以一个正弦波和一个余弦波,并找出各自的振幅。

View/Hide Original English

So for each frequency, we actually need to multiply by a sine wave and a cosine wave and find the amplitudes for each.

这些振幅的比率表示信号的相位(phase: 描述波形相对于参考点或另一波形偏移量的物理量),即它向左或向右移动了多少。

View/Hide Original English

The ratio of these amplitudes indicates the phase of the signal that is how much it's shifted to the left or to the right.

你可以分别计算这些正弦和余弦振幅,或者你可以使用欧拉公式(Euler's formula: 将复指数函数与三角函数联系起来的数学公式),这样你只需将信号乘以一个指数项。

View/Hide Original English

You can calculate these sine and cosine amplitudes separately or you can use Euler's formula so you only need to multiply your signal by one exponential term.

那么,总和的实部是余弦振幅,虚部是正弦振幅。

View/Hide Original English

Then the real part of the sum is the cosine amplitude and the imaginary part is the sine amplitude.

在日内瓦会议的美国代表团中,有一位物理学家理查德·加文(Richard Garwin)和一位数学家约翰·图基(John Tukey)。

View/Hide Original English

In the American delegation at the Geneva meeting, there was a physicist, Richard Garwin and a mathematician John Tukey.

他们与苏联代表团就哪个国家的地震仪更优越展开了辩论。

View/Hide Original English

They got into a debate with the Soviet delegation over which nation's seismometers were superior.

于是加文在CERN的一台计算机上模拟了两国设备的响应。

View/Hide Original English

So Garwin simulated the responses of both countries' devices on a computer at CERN.

第二天,所有人都同意两者之间没有太大区别。

View/Hide Original English

The next day, everyone agreed there wasn't much difference.

探测地下爆炸的真正障碍不是地震仪的精度,而是对地震仪信号进行傅里叶变换所需的巨大计算量。

View/Hide Original English

The real obstacle to detecting underground explosions wasn't the accuracy of the seismometers, it was the vast amounts of computation required to Fourier transform the seismometer signals.

这是一个地震仪信号及其傅里叶变换的例子。

View/Hide Original English

Here's an example seismometer signal and its Fourier transform.

离散傅里叶变换与计算瓶颈

到目前为止,我一直将信号视为无限连续波,当你对它们进行傅里叶变换时,你会得到一个无限连续的频率谱。

View/Hide Original English

Thus far I've been thinking about signals as infinite continuous waves and when you take their Fourier transform, you get an infinite continuous frequency spectrum.

但现实世界的信号并非如此。

View/Hide Original English

But real world signals are not like that.

它们是有限的,由单个样本或数据点组成。

View/Hide Original English

They are finite and made up of individual samples or data points.

尽管地震仪信号看起来平滑连续,但它并不能无限精确地记录地面运动。

View/Hide Original English

Even though a seismometer signal looks smooth and continuous, it doesn't record ground motion with infinite precision.

数据存在一些基本的颗粒性,所以你拥有的是离散的有限数据。

View/Hide Original English

There is some fundamental graininess to the data so what you have is discreet finite data.

因此,你不能使用理想化的傅里叶变换。

View/Hide Original English

So you can't use the idealized Fourier transform.

相反,你必须执行一种称为离散傅里叶变换(Discrete Fourier Transform, DFT: 针对有限、离散样本信号的傅里叶变换,其结果也是离散和有限的频率谱)的操作。

View/Hide Original English

Instead, you have to perform something called a Discreet Fourier Transform.

离散傅里叶变换的一个显著特点是其频率谱也是离散和有限的。

View/Hide Original English

And one of the distinguishing features of a Discreet Fourier Transform is that the frequency spectrum is also discreet and finite.

你可以将频率视为落入有限数量的“频率箱”中。

View/Hide Original English

You can think of the frequencies as falling into a finite number of bins.

决定这些频率箱数量和大小的是信号中的样本数量以及它们之间的间隔。

View/Hide Original English

And what determines the number and size of these bins is the number of samples in the signal and how closely spaced they are.

例如,样本间隔越大,你能测量的最大频率就越低。

View/Hide Original English

For example, the more spaced out the samples are, the lower the maximum frequency you can measure.

因为样本不够密集,无法捕捉高频振荡,信号持续时间越短,区分相似频率就越困难。

View/Hide Original English

Because the samples aren't close enough together to capture high frequency oscillations, the shorter the duration of the signal, the harder it is to tell similar frequencies apart.

这会降低频率分辨率。

View/Hide Original English

So this lowers the frequency resolution.

信号越短,每个频率箱就越宽。

View/Hide Original English

The shorter the signal, the wider each frequency bin is.

你能有效测量的最低非零频率是其周期等于信号持续时间的频率。

View/Hide Original English

The lowest non-zero frequency you can effectively measure is one whose period is equal to the duration of the signal.

而更高频率的频率箱只是这个频率的整数倍。

View/Hide Original English

And the higher frequency bins are just integer multiples of this frequency.

所以它们在信号持续时间内分别包含两个、三个、四个等等周期。

View/Hide Original English

So they fit two, three, four, and so on periods in the duration of the signal.

频率箱的总数等于信号中的样本数量。

View/Hide Original English

The total number of frequency bins is equal to the number of samples in the signal.

因此,如果信号由八个样本组成,那么变换将有八个频率箱,从零到基频的七倍。

View/Hide Original English

So if the signal is made up of eight samples, then the transform has eight frequency bins going from zero up to seven times the fundamental frequency.

我们来举个例子。

View/Hide Original English

So let's do an example.

假设我们有一个由八个样本组成的信号。

View/Hide Original English

Say we have a signal made up of eight samples.

那么离散傅里叶变换将有八个频率箱。

View/Hide Original English

Well, then the discrete Fourier transform will have eight frequency bins.

第一个频率箱对应于零频率。

View/Hide Original English

The first bin corresponds to a frequency of zero.

这本质上是测量信号是否系统性地偏离x轴。

View/Hide Original English

Essentially this measures if the signal is systematically shifted off the x-axis.

你可以将其视为测量直流偏移。

View/Hide Original English

You can think of it as measuring the DC offset.

你将每个数据点乘以一,然后将它们全部相加,在这种情况下,它们相加为零。

View/Hide Original English

You multiply each data point by one and add them all together, in this case, they add to zero.

第二个频率箱对应于在信号持续时间内包含一个周期的频率。

View/Hide Original English

The second frequency bin corresponds to the frequency that fits one period in the duration of the signal.

因此,在这种情况下,它对应于一赫兹。

View/Hide Original English

So in this case that corresponds to one hertz.

你将每个点乘以这个频率的正弦波和这个频率的余弦波,然后分别相加。

View/Hide Original English

You multiply each point by a sine wave of this frequency and a cosine wave of this frequency and separately add them up.

对于正弦波,它们相加为零。

View/Hide Original English

For sine, they add to zero.

对于余弦波,它们相加为四,然后对两赫兹、三赫兹等重复这个过程,直到七赫兹。

View/Hide Original English

For cosine, they add to four and then repeat the process for two hertz, three hertz, and so on, up to seven hertz.

你就得到了这个非常简单信号的离散傅里叶变换。

View/Hide Original English

And you have the discreet Fourier transform of this really simple signal.

现在,这个过程原则上运行良好,你可以用它来计算所有离散傅里叶变换。

View/Hide Original English

Now this process works fine in principle and you could use it to calculate all discrete Fourier transforms.

但问题是它需要太多的计算。

View/Hide Original English

But the problem is it requires way too many calculations.

完成一次离散傅里叶变换需要将N个数据点乘以N个不同频率的波。

View/Hide Original English

To complete one discrete Fourier transform requires multiplying N data points by N different frequency waves.

也就是N的平方次复数乘法(complex multiplication: 涉及复数的乘法运算,在傅里叶变换中用于处理信号的幅度和相位)。

View/Hide Original English

So N squared complex multiplications.

这对于八个样本是可行的,但如果你有一百万个样本,那将需要一百万的平方,即一万亿次计算。

View/Hide Original English

Now this is doable for eight samples but if you had say a million samples, that would require a million squared or one trillion calculations.

以1960年代计算机的速度,完成一次变换需要三年多时间。

View/Hide Original English

At the speed of 1960s computers, that would take over three years to complete, all for a single transform.

当然,一百万个样本对于单个地震事件来说可能有点多,但要分析每天数十个事件,来自数百个地震仪的数据,那将太耗时了。

View/Hide Original English

Now a million samples is admittedly more than you would need for a single seismic event but to analyze tens of events per day from hundreds of seismometers, it would just be far too time consuming

这正是促使科学家们寻找更好方法的原因。

View/Hide Original English

and that's what gave scientists the impetus to look for a better way.

快速傅里叶变换的诞生与效率飞跃

突破发生在1963年总统科学顾问委员会的一次会议上。

View/Hide Original English

And the breakthrough came in 1963 at a meeting of the President's Science Advisory Committee.

约翰·F·肯尼迪总统在场,加文和图基也在场,他们是日内瓦会议上的物理学家和数学家。

View/Hide Original English

President John F. Kennedy was there, as were Garwin and Tukey, the physicist and mathematician from the Geneva meeting.

尽管他们正在讨论阿波罗计划和核辐射避难所等国家重要问题,但会议显然相当无聊。

View/Hide Original English

Although they were discussing issues of national importance like the Apollo program and nuclear fallout shelters, the meeting was apparently pretty boring.

加文观察到图基一直在涂鸦,但他实际上是在研究离散傅里叶变换。

View/Hide Original English

Garwin observed Tukey doodling throughout but what he was actually doing was working on discreet Fourier transforms.

会议结束时,加文问图基他研究出了什么,他震惊地得知图基知道一种用更少计算量计算离散傅里叶变换的方法。

View/Hide Original English

At the end of the meeting, Garwin asked Tukey what he had worked out and he was shocked to learn that Tukey knew a way to compute discreet Fourier transforms with many fewer computations.

这意味着原本需要三年多才能完成的计算,现在只需35分钟。

View/Hide Original English

It would mean that the calculation that would've taken over three years could be done in just 35 minutes.

这被恰当地称为快速傅里叶变换

View/Hide Original English

This has aptly become known as the Fast Fourier Transform.

那么它是如何工作的呢?

View/Hide Original English

So here is how it works.

考虑之前八个样本的例子。

View/Hide Original English

Consider the example from before with eight samples.

每个数据点都必须乘以八个不同频率的波。

View/Hide Original English

Each of those data points must be multiplied by the eight different frequency waves.

这里我为了简化只显示余弦波。

View/Hide Original English

Here I'm only showing cosines for simplicity.

所以你可能会认为这需要八乘以八,即64次复数乘法。

View/Hide Original English

So you would expect this to require eight times eight or 64 complex multiplication.

但由于正弦函数(sinusoidal functions: 描述周期性波动的数学函数,包括正弦波和余弦波)的周期性,这些不同频率的波以可预测的方式重叠。

View/Hide Original English

But due to the periodic nature of sinusoids, these waves of different frequencies overlap in a predictable way.

例如,在中间数据点,所有四个奇数频率都具有相同的值,所有四个偶数频率也具有相同的值。

View/Hide Original English

For example, at the middle data point, all of the four odd frequencies have the same value and all of the four even frequencies have the same value as well.

所以你只需要进行两次乘法,而不是八次。

View/Hide Original English

So instead of doing eight multiplication, you only need to do two.

这种重复也发生在其他数据点。

View/Hide Original English

And this sort of duplication occurs at the other data points as well.

因此,你只需要执行24次计算,而不是64次。

View/Hide Original English

So instead of performing 64 calculations, you need only 24.

现在这看起来可能只是一个小小的改进,但它代表着计算量从样本数量的平方(N^2)到N乘以以2为底的N的对数(N log2 N)的巨大差异。

View/Hide Original English

Now that might seem like a small improvement but it's the difference between a calculation that scales as N, the number of samples squared versus one that scales as Nlog base two of N

这意味着数据集越大,节省的计算量就越大。

View/Hide Original English

which means the bigger the data set, the greater the savings.

一个包含一千个样本的信号将需要少一百倍的计算,而一百万个样本将需要少五万倍的计算。

View/Hide Original English

A signal with a thousand samples would require 100 times fewer calculations and a million samples would require 50,000 times fewer calculations.

但你如何知道哪些计算是冗余的呢?

View/Hide Original English

But how do you know which calculations are redundant?

好吧,将你的样本分成偶数和奇数索引点。

View/Hide Original English

Well, take your samples and split them into even and odd index points.

你仍然需要将其中每个点乘以八个不同频率的波。

View/Hide Original English

You still need to multiply each of these by the eight different frequency waves.

但现在我们只看偶数点,并将前四个频率与后四个频率进行比较。

View/Hide Original English

But now let's look only at the even points and compare the first four frequencies to the second four frequencies.

你会发现在每种情况下,在样本位置,两个正弦波的值是相同的。

View/Hide Original English

And what you find is that in each case at the location of the samples, the values of the two sine waves are the same.

对于奇数索引点也可以观察到类似的模式,只是一个正弦波的值是另一个的负值。

View/Hide Original English

A similar pattern can be observed for the odd index points except the values of one sine wave are the negative of the other.

更一般地说,它们通过一个复数相关联。

View/Hide Original English

More generally, they're related by a complex number.

但这意味着你不需要对后半部分的频率进行所有乘法。

View/Hide Original English

But what this means is that you don't have to do all the multiplication for the second half of the frequencies.

一旦你计算出前半部分频率的奇数和偶数和,你就可以重用这些值来找到后半部分。

View/Hide Original English

Once you've calculated the odd and even sums for the lower half the frequencies, you can reuse these values to find the upper half.

所以你实际上将所需的计算量减少了一半,但这只是一个两倍的因素,你如何将其降低到N log2 N呢?

View/Hide Original English

So you've effectively cut the number of calculations required in half but that's only a factor of two, how do you get down to Nlog base two of N?

好吧,你重复同样的技巧,再次将样本分成偶数和奇数点,然后反复进行,直到你只剩下单个数据点。

View/Hide Original English

Well, you repeat the same trick, split the samples again into even an odd points and then again repeatedly until you're down to single data points.

在每次分割时,你可以利用正弦函数的对称性将计算量减少一半。

View/Hide Original English

At each split, you can exploit the symmetries of sinusoidal functions to cut the number of calculations in half.

这就是快速傅里叶变换如何将N的平方次计算减少到N log N的原因。

View/Hide Original English

And that is how the Fast Fourier Transform reduces N squared calculations down to NlogN.

这也是为什么今天任何人进行傅里叶变换时,几乎总是使用快速傅里叶变换。

View/Hide Original English

And it's why today whenever anyone takes a Fourier transform, it's almost always done as a Fast Fourier Transform.

FFT的深远影响与历史的遗憾

加文找到IBM研究员詹姆斯·库利(James Cooley),请他编写程序运行FFT算法,但他没有告诉库利原因是为了探测苏联的地下核试验。

View/Hide Original English

Garwin approached an IBM researcher, James Cooley to program a computer to run the FFT algorithm but he didn't tell him the reason was to detect underground Soviet nuclear tests.

他说这是为了计算氦-3晶体中的自旋。

View/Hide Original English

He said it was to work out the spins in a crystal of helium-3.

库利和图基在1965年的一篇开创性论文中发表了该算法,其应用立即普及开来,但为时已晚,无法确保全面的核禁试。

View/Hide Original English

Cooley and Tukey published the algorithm in a seminal 1965 paper and its use immediately took off but it was too late to secure a comprehensive nuclear test ban.

那时,英国、法国和中国已经与苏联和美国一起成为核大国。

View/Hide Original English

By that time, the U.K., France and China had joined the Soviet Union and the U.S. as nuclear powers.

部分禁试条约远没有缓解核军备竞赛,反而将其转入地下。

View/Hide Original English

And the partial test ban treaty, far from deescalating the nuclear arms race just sent it underground.

当时的思路是,如果只允许地下试验,那么你就最好进行广泛的试验,以免落后于其他核国家。

View/Hide Original English

The thinking was if you were only allowed to test underground, then you better be testing extensively so as not to fall behind all the other nuclear states.

因此,从1963年起,共引爆了1500枚核武器。

View/Hide Original English

So from 1963, 1,500 nuclear weapons were detonated.

这相当于30年里每周一枚。

View/Hide Original English

That's roughly one a week for 30 years.

这些试验促成了荒谬数量的核武器的建造。

View/Hide Original English

This testing facilitated the construction of an absurd number of nukes.

在1980年代中期的高峰期,存在着7万枚核弹头。

View/Hide Original English

At the peak in the mid 1980s, 70,000 nuclear warheads were in existence.

根据通货膨胀调整,20世纪核武器的总支出估计美国和苏联各约为10万亿美元。

View/Hide Original English

Total expenditure on nukes in the 20th century is estimated at around $10 trillion each for the U.S. and the Soviet Union adjusting for inflation.

如果科学家们在1960年代初对远程探测地下试验的能力有信心,那么就可以达成一项全面的禁试条约,在核军备竞赛真正开始之前就将其阻止。

View/Hide Original English

If only scientists had been confident in their ability to remotely detect underground tests in the early 1960s, then a comprehensive test ban could have been reached, stopping the nuclear arms race before it really got going.

为了验证这是否现实,我亲自询问了理查德·加文。

View/Hide Original English

To check how realistic this is, I asked Richard Garwin himself.

  • 嗯,这是一个好故事。
View/Hide Original English

- Well, it's a good story.

  • 确实是一个好故事。
View/Hide Original English

- It is a good story.

  • 它会有帮助,而且可能会扭转局面。
View/Hide Original English

- It would've helped and it might have turned the tide.

但这需要更早发现快速傅里叶变换,巧合的是,它确实被更早发现了,但后来被遗忘了。

View/Hide Original English

- But that would've required an earlier discovery of the Fast Fourier Transform and as luck would have it, it was discovered earlier but then forgotten.

高斯的早期发现与被遗忘的突破

早在1805年,数学家卡尔·弗里德里希·高斯(Carl Friedrich Gauss)就在研究新发现的小行星帕拉斯(Pallas)、谷神星(Ceres)和婚神星(Juno)。

View/Hide Original English

All the way back in 1805, Mathematician Carl Friedrich Gauss was studying the newly discovered asteroids of Pallas, Ceres and Juno.

为了确定婚神星的轨道,高斯设计了一种新颖的谐波分析方法,他将其记录在笔记中,但后来使用了不同的方法,并且从未想过发表他的第一个见解。

View/Hide Original English

To determine the orbit of Juno, Gauss devised a novel approach to harmonic analysis and he jotted it down in his notes but later used a different method and he never thought to publish that first insight.

今天我们可以看到,高斯在约瑟夫·傅里叶(Joseph Fourier)本人于1807年发表之前,就已经弄清楚了离散傅里叶变换。

View/Hide Original English

Today we can see that Gauss had figured out the discreet Fourier Transform before Joseph Fourier himself published it in 1807.

他比库利和图基早一个半世纪就开发出了相同的快速傅里叶变换算法。

View/Hide Original English

And he had developed the same Fast Fourier Transform algorithm as Cooley and Tukey a century and a half earlier.

他的突破未能广泛应用的原因是,它只在他去世后才出现在他文集第三卷中,而且是用19世纪的拉丁文以非标准符号书写的。

View/Hide Original English

The reason his breakthrough was not widely adopted was because it only appeared after his death in volume three of his collected works and it was written with non-standard notation in a 19th century version of Latin.

你认为如果高斯意识到他发现的重要性并以他人能够理解的方式发表它,会发生什么?

View/Hide Original English

What do you think would've happened if Gauss had realized the significance of his discovery and had published it in a way that others could understand?

FFT的现代应用与未来展望

凭借我们现代的地震仪网络、计算能力和快速傅里叶变换,今天我们有能力探测到震级三级的事件,这相当于一千吨左右的爆炸,基本上可以在地球上的任何地方。

View/Hide Original English

With our modern network of seismometers and computing and the Fast Fourier Transform, today, we have the ability to detect magnitude three events which correspond to a one kilo ton or so explosion, basically anywhere on earth.

在库利和图基的论文发表后,FFT的应用呈爆炸式增长,它们是大多数压缩算法的基础,比如让你观看和收听这个视频的算法。

View/Hide Original English

Following Cooley and Tukey's paper, the use of FFTs exploded and they are the basis for most compression algorithms like the ones that allow you to watch and listen to this video.

以下是快速傅里叶变换如何让你压缩图像的例子。

View/Hide Original English

Here's how the Fast Fourier Transform allows you to compress an image.

你获取图像每一行的像素亮度值(pixel brightness values: 图像中每个像素的亮度强度数值),并执行快速傅里叶变换。

View/Hide Original English

You take the pixel brightness values for each row of an image and perform a Fast Fourier transform.

所以本质上,你是在找出图像行亮度值中存在哪些频率。

View/Hide Original English

So essentially, you're figuring out what frequencies are present in the brightness values of the rows of an image.

这里,亮度代表每个频率分量(frequency component: 信号中特定频率的正弦波或余弦波成分)的幅度,颜色代表相位(phase: 描述波形相对于参考点或另一波形偏移量的物理量),即该频率向左或向右移动了多少。

View/Hide Original English

Here, brightness represents the magnitude of each frequency component and the color represents the phase, how shifted that frequency is to the left or the right.

然后你再对像素列执行另一次FFT。

View/Hide Original English

And then you perform another FFT for the columns of pixels.

无论是先处理行还是列都无关紧要,你需要的是原始图像的二维FFT。

View/Hide Original English

It doesn't matter if you do the rows or columns first, which you need is a two dimensional FFT of the original image.

对于几乎所有真实世界的图像,你会发现变换中的许多值都接近于零。

View/Hide Original English

For almost all real world images, you find that a lot of the values in the transform are close to zero.

我取了变换值的对数,这样你就能看到它们,但如果我不这样做,那么很明显,大多数值,特别是靠近边缘的值,都非常小,这些对应于高频。

View/Hide Original English

I've taken the log of the transform values so you can see them but if I don't, then it's clear most of the values, especially toward the edges are very small and these correspond to high frequencies.

这意味着你可以丢弃变换图像中的大部分信息,比如99%。

View/Hide Original English

And what this means is that you can throw out a lot of the information in the transformed image say 99% of it.

但当你反转这个结果时,你仍然可以得到原始图像相当好的表示。

View/Hide Original English

But when you invert that result, you still get a fairly good representation of the original image.

所以,在你的计算机上,大多数图像将以这种形式保存为二维快速傅里叶变换,然后当你再次想看图片时,计算机只需反转变换。

View/Hide Original English

So on your computer, most of the images will be saved in this form as a two dimensional Fast Fourier Transform and then when you wanna look at the picture again, the computer simply inverts the transform.

FFT的应用非常广泛,从求解微分方程到雷达和声纳,研究晶体结构,WiFi和5G。

View/Hide Original English

There are so many applications for FFTs from solving differential equations to radar and sonar, studying crystal structures, WiFi and 5G.

基本上所有类型的信号处理都使用FFT,这就是为什么数学家吉尔伯特·斯特朗(Gilbert Strang)称FFT为我们一生中最重要的数值算法。

View/Hide Original English

Basically all kinds of signal processing use FFTs and that's why mathematician Gilbert Strang called the FFT the most important numerical algorithm of our lifetime.

如果它在高斯发现后能更广泛地被采用,FFT可能会更戏剧性地改变我们的世界。

View/Hide Original English

If only it had become more widely adopted after Gauss discovered it, the FFT may have even more dramatically transformed our world.

现在,我认为高斯永远无法想象FFT会变得多么重要,就像大多数人不会思考他们一生工作的累积影响一样。

View/Hide Original English

Now I don't think Gauss could ever have imagined how important the FFT would be, just as most people don't think about the cumulative impact of their life's work.

赞助商信息:80,000 Hours

你知道,在平均职业生涯中,你每周工作40小时,每年50周,持续40年,这相当于8万小时。

View/Hide Original English

You know in an average career, you work 40 hours a week, 50 weeks a year for 40 years and that works out to 80,000 hours.

这意味着你的职业生涯可能是你对世界产生影响的最大机会。

View/Hide Original English

It means that your career might be your biggest opportunity to make a difference in the world.

那么,你打算用所有这些时间做什么呢?

View/Hide Original English

So what do you wanna do with all that time?

这个视频的赞助商名叫“80,000 Hours”,指的是你可能产生的影响力,以及你工作所花费的时间。

View/Hide Original English

Now the name of this video sponsor is 80,000 Hours referencing the amount of impact you can have, the amount of hours you spend at work,

他们不销售任何东西。

View/Hide Original English

and they are not selling anything.

“80,000 Hours”是一个非营利组织,帮助人们找到既有成就感又能产生积极影响的职业。

View/Hide Original English

80,000 Hours is a nonprofit that helps people find fulfilling careers that make a positive impact.

职业中心或能力测试的典型建议通常只关注寻找一份符合你个人偏好的工作。

View/Hide Original English

The typical advice from career centers or aptitude tests really just focuses on finding a job that fits your personal preferences.

但如果你更关心做好事呢?

View/Hide Original English

But what if you care more about doing good?

那么,除了医生或教师等少数知名职业外,他们真的不知道该告诉你什么。

View/Hide Original English

Well, they won't really know what to tell you besides a few well known professions like being a doctor or a teacher.

我大学毕业时,我知道我喜欢电影制作、教学和科学,并且我想产生巨大的积极影响,但YouTube当时还不存在,所以我真的不知道我该做什么。

View/Hide Original English

When I finished college, I knew I liked filmmaking, teaching and science and that I wanted to have a big positive impact but YouTube didn't exist yet and so I honestly had no idea what I was gonna do.

现在我感到非常幸运,每天都能做一些我既喜欢又能对世界产生积极影响的事情。

View/Hide Original English

Now I feel really fortunate to be able to do something every day that I both enjoy and which makes a positive impact on the world.

所以请相信我,有很多事情你可以做,“80,000 Hours”提供了大量的资源来帮助你找到这些事情。

View/Hide Original English

So believe me, there are a lot of things out there that you can do and 80,000 Hours offers tons of resources to help you find those things.

从关于如何选择一个解决紧迫问题的职业的基于研究的指南,到定期的时事通讯和播客。

View/Hide Original English

From research backed guides on how to pick a career that tackles pressing issues to a regular newsletter and podcast.

他们甚至有一个精心策划的招聘板,实时更新着他们认为能产生影响的数百个职位。

View/Hide Original English

They even have a curated job board that's kept up to date with hundreds of jobs they think will make an impact.

他们与牛津大学的学者们进行了超过十年的研究,探讨如何找到一份既有成就感又能产生积极影响的职业。

View/Hide Original English

They have done over 10 years of research alongside academics at Oxford University on how to find a career that is both fulfilling and which makes a positive difference.

所以他们的建议是准确、具体和可操作的。

View/Hide Original English

So their recommendations are accurate, specific, and actionable.

如果你关心证据如何说明如何拥有一个有影响力的职业,并且你想要超越“追随你的热情”等空洞陈词滥调的真实建议,那么请查看“80,000 Hours”。

View/Hide Original English

If you care about what the evidence says about having an impactful career and you want real advice that goes beyond empty cliches like follow your passion, then check out 80,000 Hours.

他们提供的所有内容,从播客到招聘板,都是永久免费的。

View/Hide Original English

Everything they provide from their podcast to their job board is free forever.

如果你现在订阅他们的时事通讯,你还会收到一份免费的深度职业指南,直接发送到你的收件箱。

View/Hide Original English

If you join the newsletter right now, you'll also get a free copy of their in-depth career guide sent right to your inbox.

所以,要开始一个解决世界上最紧迫问题的职业,请立即在80000hours.org/veritasium注册。

View/Hide Original English

So to get started on a career that tackles the world's most pressing problems, sign up now at 80000hours.org/veritasium.

我会把这个链接放在描述中。

View/Hide Original English

I will put that link down in the description.

我要感谢“80,000 Hours”赞助了视频的这一部分,也要感谢你的观看。

View/Hide Original English

So I wanna thank 80,000 Hours for sponsoring this part of the video and I wanna thank you for watching.

📌 文中提及的人物和组织

关键字: canada efficiency fast-fourier-transform history nuclear