## 字幕列表 影片播放

• Last video I left you with a puzzle. The setup involves two sliding blocks in a perfectly

在上一支影片當中，我提出了一個問題 有兩個滑動的方塊

• idealized world where there's no friction, and all collisions are perfectly elastic,

在沒有摩擦力，且所有的碰撞 皆為完全彈性碰撞的理想情況下

• meaning no energy is lost. One block is sent towards another smaller one, which starts

也就是沒有任何的能量散失 其中一個大方塊撞向另外一個維持不動的小方塊

• off stationary, and there's a wall behind it so that the small one bounces back and

並且左側有面牆 導致小方塊會不斷地反彈回去

• forth until it redirects the big block's momentum enough to outpace it away from the

直到小方塊的速度追不到大方塊

• wall.

如果大方塊的質量比小方塊還要大100的某次方倍時

• If that first block has a mass which is some power of 100 times the mass of the second,

例如1百萬倍(100^3) 會有個非常驚人的事實

• for example 1,000,000 times as much, an insanely surprising fact popped out: The total number

碰撞的總數，包含了小方塊撞到牆壁的次數

• of collisions, including those between the second mass and the wall, has the same starting

會跟圓周率 π 的前幾位數字相同 在這個例子中，發生了3,141次碰撞

• digits as pi. In this example, that's 3,141 collisions.

如果大方塊的質量是小方塊的1萬億倍(100^6) 總共會有3,141,592次的碰撞

• If it was one trillion times the mass, it would take 3,141,592 collisions before this

幾乎所有的碰撞都在一個爆發中發生

• happens, almost all of which happen in one huge burst.

提到了爆發，在上支影片發布後

• Speaking of unexpected bursts, in the short time since that video lots of people have

在很短的時間內，有非常多的網友們 分享了他的解法、嘗試和模擬，我覺得很好

• shared solutions, attempts, and simulations, which is awesome. See the description for

(點開完整訊息來看我喜歡的)

• some of my favorites. So why does this happen?! Why should pi show up in such an unexpected

所以為什麼會這樣？ 為什麼 π 會在這個意想不到的地方出現？

• place, and in such an unexpected manner?

並以這種意想不到的方式出現？

• First and foremost this is a lesson about using a phase space, also commonly called

首先，我們要利用相空間(又被稱為位形空間) 來解決這個問題

• a configuration space, to solve problems. So rest assured that you're not just learning

所以請放心，你不僅僅是在學 π 的深度算法

• about an esoteric algorithm for pi, the tactic here is core to many other fields.

這個手法是其他許多領域的核心 是一個適合牢牢記住的好用工具

• To start, when one block hits another, how do you figure out how the velocity of each

一開始，當第一個方塊撞到另外一個方塊時 你要怎麼知道它們碰撞後的速度分別是多少？

• one after the collision? The key is to use the conservation of energy, and the conservation

關鍵是要利用「能量守恆」以及「動量守恆」

• of momentum. Let's call their masses m1 and m2, and their velocities v1 and v2, which

我們先假設兩個方塊的質量分別是m1和m2 而速度分別是v1及v2

• will be variables changing throughout the process.

v1和v2會是碰撞過程中的變數

• At any given moment, the total kinetic energy is (½)m1(v1)^2 + (½)m2(v2)^2. Even though

無論什麼時候，動能總和都會是 (½)m1(v1)^2 + (½)m2(v2)^2

• v1 and v2 will change as the blocks get bumped around, the value of this expression must

所以說，雖然v1和v2會因為方塊的碰撞而改變 但是這個式子的值一定會是一個常數

• remain constant. The total momentum of the two blocks is m1*v1 + m2*v2. This also remains

兩個方塊的動量總和是 m1*v1 + m2*v2

• constant when the blocks hit each other, but it can change as the second block bounces

當兩個方塊互撞時，這個式子的值也會是一個定值

• off the wall. In reality, that second block would transfer its momentum to the wall during

但當小方塊撞到牆壁的時候，這個式子的值就會改變

• this collision. Again we're being idealistic, say thinking of the wall as having infinite

在現實中，碰撞到牆壁時 小方塊會將自己的動量傳給牆壁

• mass, so such a momentum transfer won't actually move the wall.

但再重申一次，我們是理想主義者 假設牆壁有著無窮大的質量

• So we've got two equations and two unknowns. To put these to use, try drawing a picture

因此當動量轉移給牆壁時 並不會讓牆壁有所移動

• to represent the equations.

我們目前有兩個方程式和兩個未知數

• You might start by focusing on this energy equation. Since v1 and v2 are changing, maybe

要解聯立的話，可以畫兩個方程式的座標圖

• you think to represent this equation on a coordinate plane where the x-coordinate represents

你或許會先從能量守恆的式子開始下手 因為v1和v2是變數

• v1, and the y-coordinate represents v2. So individual points on this plane encode the

所以在座標平面上表示該式 其中x座標為v1，y座標代表v2

• pair of velocities of our block. In that case, the energy equation represents an ellipse,

因此在這個座標上的各點 代表了兩個方塊的速度

• where each point on this ellipse gives you a pair of velocities, and all points of this

在這個情況下，能量守恆的式子會是一個橢圓

• ellipse correspond to the same total kinetic energy.

在橢圓上每個點的座標都代表一對速度

• In fact, let's actually change our coordinates a little to make this a perfect circle, since

而所有的點都有著相同的總動能

• we know we're on a hunt for pi. Instead of having the x-coordinate represent v1, let

事實上，我們把座標稍微改變一點 讓橢圓變成一個圓

• it be sqrt(m1)*v1, which for the example shown stretches our figure in the x-direction by

因為我們要知道 π 是從哪裡來的

• sqrt(10). Likewise, have the y-coordinate represent sqrt(m2)*v2. That way, when you

因此不要使x座標為v1 而是(√m1)*v1

• look at this conservation of energy equation, it's saying ½(x^2 + y^2) = (some constant),

在這個例子中 會在x方向將圖形拉長了√10倍

• which is the equation for a circle. Which specific circle depends on the total energy.

同理，使y座標為(√m2)*v2

• At the beginning, when the first block is sliding to the left and the second one is

這樣的話，能量守恆的式子就會變成 ½(x^2 + y^2) 等於一個常數

• stationary, we are at this leftmost point on the circle, where the x-coordinate is negative

也就是圓的方程式 圓的大小取決於總能量，不過在這個問題中並沒有差別

• and the y-coordinate is 0. What about after the collision, how do we know what happens?

一開始，大方塊向左滑動，而小方塊保持靜止

• Conservation of energy tells us we must jump to some other point on this circle, but which

此時位於圓的最左側的點

• one?

x的座標是負值 y的座標為0

• Well, use the conservation of momentum! This tells us that before and after a collision,

那在碰撞之後呢？ 我們要怎麼知道發生了什麼事？

• the value m1*v1 + m2*v2 must stay constant. In our rescaled coordinates, that looks like

能量守恆告訴了我們每個點只能在這個圓上移動 但是是在哪一點？

• saying sqrt(m1)*x + sqrt(m2)*y = (some constant), which is the equation for a line with slope

此時就要用動量守恆了

• -sqrt(m1/m2). Which specific line depends on what that constant momentum is. But we

動量守恆告訴我們 m1*v1 + m2*v2 的值一定等於一個常數

• know it must pass through our first point, which locks us into place.

在我們重新調整的座標中 這個式子會變成 (√m1)x + (√m2)y 等於一個常數

• Just to be clear what all this is saying: All other pairs of velocities which would

也就是直線的方程式 一條斜率為 -√(m1/m2) 的直線

• give the same momentum live on this line, just as all other pairs of velocities which

你或許會問那條線的確切位置在哪 這要取決於該方程式的常數決定

• give the same energy live on our circle. So notice, this gives us one and only one other

但確定的是，它一定會經過第一個點 所以只剩下一種可能

• point that we could jump to. And it should make sense that it's something where the

先將這一切給弄清楚，在這條線上， 每對速度都有著相同的總動量

• x-coordinate gets a little less negative and the y-coordinate is negative, since that corresponds

就像是在這個圓上 每對速度都有著相同的總能量

• to our big block slowing down a little while the little block zooms off towards the wall.

因此請注意，這裡給了我們一個 也是唯一一個可以跳過去的點

• When the second block bounces off the wall, it's speed stays the same, but will go from

應該滿有道理的，因為x座標的值變大了一些 而y座標的值變成了負值

• negative to positive. In the diagram, this corresponds to reflecting about the x-axis,

對應了大方塊速度降低了一些 而小方塊往牆壁方向前進

• since the y-coordinate gets multiplied by -1. Then again, the next collision corresponds

從這裡開始，看看事情如何發展還滿有趣的 當小方塊撞到牆壁反彈的時候

• to a jump along a line of slope -sqrt(m1 / m2), since staying on such a line is what conservation

它的速度量值會維持一樣 但會由負值變成正值

• of momentum looks like in this diagram.

在座標圖中，就像是對x軸鏡射

• This gives us a very satisfying picture of how we hop around on our picture, where you

因為y座標的值乘了(-1)

• keep going until the velocity of that smaller block is both positive, and smaller than the

接下來，下一次的碰撞對應了 沿著斜率為 -√(m1/m2) 的直線的點跳躍

• velocity of the big one, meaning they'll never touch again. That corresponds to this

因為在該線上移動就是動量守恆的式子在圖形中的模樣

• region of the diagram, so in our process, we keep bouncing until we land in that region.

從這裡，你可以藉由方塊的碰撞情形 將圓裡剩餘的部分給填滿

• What we've drawn here is called a “phase diagram”, which is a simple but powerful

持續這個步驟，直到小方塊的速度是正值 並且小於大方塊的速度

• idea in math where you encode the state of some system, in this case the velocities of

也就是它們不會再發生碰撞

• our sliding blocks, as a single point in some abstract space. What's powerful here is

這對應到了座標圖中，右上角這個三角形的區域 因此在過程中，點會不斷地跳躍，直到落到該區域內

• that it turns questions about dynamics into questions about geometry. In this case, the

我們畫的這張圖稱做「相圖」 它是一個簡單但強大的數學概念

• dynamical idea of all pairs of velocities that conserve energy corresponds to the geometric

你可以將某個系統的狀態給繪製出來 在這個例子中，也就是滑動方塊的速度

• object of a circle, and counting the total number of collisions turns into counting the

並在一個抽象的空間中以點的形式出現

• number of hops along these lines, alternating between vertical and diagonal.

強大的地方在於，它將動力學的問題 變成了幾何的問題

• Specifically, why is it that when the mass ratio is a power of 100, that number of steps

在這個情況下，在動力學中所有可能的每對速度 都必須維持能量守恆，對應到了在幾何中的圓

• shows the digits of pi?

計算方塊碰撞的次數變成了計算 點沿著這些線的跳躍次數

• Well, if you stare at this picture, maybe, just maybe, you might notice that all the

這些線在鉛直與斜線兩者交替

• arc-lengths between the points of this circle seem to be about the same. It's not immediately

不過問題還是沒有解答 為什麼當質量比值為100時

• obvious that this should be true, but if it is, it means that computing the value of that

總碰撞次數會有 π 的數字？

• one arc length should be enough to figure out how many collisions it takes to get around

如果你看著這張圖，或許，只是或許

• the circle to the end zone.

你會發現在圓上每個點跟點之間的圓弧的長度 都會是一樣的

• The key here is to use the ever-helpful inscribed angle theorem, which says that whenever you

雖然這件事情並非顯而易見的 但這件事情代表了

• form an angle using three points on a circle P1, P2 and P3 like this, it will be exactly

只要計算了一個圓弧的長度 就可以知道需要幾次的碰撞才能夠到達結束區域

• half the angle formed by P1, the circle's center, and P3. P2 can be anywhere on this

這裡的關鍵就是利用永遠有用的「圓周角定理」

• circle, except in that arc between P1 and P3, and this fact will be true.

圓周角定理表示，當你用三個在圓上的點 P1、P2、P3形成一個角度時

• So now look at our phase space, and focus specifically on three points like these. Remember

該角度剛好會是由 P1、圓心、P3 所形成的角度

• this first vertical hop corresponds to the small block bouncing off the wall, and the

P2 可以在圓上任何一點 除了 P1 與 P3 之間

• second hop along a slope of -sqrt(m1 / m2) corresponds to a momentum-conserving block

這個定理永遠都會是正確的

• collision. Let's call the angle between this momentum line and the verticaltheta”.

現在回到我們的相空間 並專注於這三個點

• Then using the inscribed angle theorem, the arc length between these bottom two points,

第一個鉛直跳躍代表了小方塊撞到牆壁反彈

• measured in radians, will be 2*theta. Notice, since this momentum line has the same slope

第二個沿著斜率為 -√(m1/m2) 的斜線的跳躍 代表了方塊碰撞時的動量守恆

• for all of those jumps from the top of the circle to the bottom, the same reasoning means

我們把動量守恆線和鉛直線之間所形成的角度稱做 θ

• all of these arcs must also be 2*theta.

現在你大概發現了 利用圓周角定理

• So for each hop, if we drop down a new arc, like so, then after each collision we cover

下方兩點所形成的圓弧的長度(單位為弧度) 將會是 2θ

• another 2*theta radians of the circle. We stop once we're in this endzone, corresponding

很重要的是，所有從圓上方跳到圓底部的跳躍 都沿著相同斜率的動量守恆線

• to both blocks moving to the right, with the smaller one going slower. But you can also

因此，這些圓弧的長度都會是 2θ

• think of this as stopping at the point when adding another arc of 2*theta would overlap

所以，對於每個跳躍 如果我們放了一個新的弧，相這樣

• with a previous one.

那麼在每次的碰撞後，我們在圓上 再放另外一個長 2θ 的圓弧

• In other words, how many times do you have to add 2*theta to itself before it covers

直到觸碰到停止區域就停止，別忘了停止區域代表 兩個方塊都向右，但小方塊速度較小

• more than 2*pi radians? The answer to this is the same as the number of collisions between

不過你也可以把它想像成：再加一個 長 2θ 的圓弧會導致它覆蓋到另外一個圓弧時的停止點

• our blocks.

換句話說，在覆蓋超過整個圓 2π 前 你可以加多少個 2θ ？

• Or, simplifying things a little, what's the largest integer multiple of theta that

這個問題的答案與方塊的碰撞次數一樣

• doesn't surpass pi?

更簡潔的說，在不大於 π 的情況下 θ 的最大整數倍是多少？

• For example, if theta was 0.01 radians, then multiplying by 314 would put you a little

舉個例子，如果 θ = 0.01 弧度 那麼將它乘以314會使之小於 π

• less than pi, but multiplying by 315 would bring you over that value. So the answer would

但乘以315，則會超過 π

• be 314, meaning if our mass ratio were one such that the angle theta in our diagram was

所以答案會是314 也就是如果有某個質量比值使得圖中的 θ = 0.01

• 0.01, the blocks would collide 314 times.

那麼方塊的碰撞次數將會是314次

• In fact, let's go ahead and compute theta, say when the mass ratio is 100 : 1. Remember

現在，你知道該怎麼做了 那麼我們現在來真正的計算 θ 的值

• that the rise-over-run slope of this constant momentum line is -sqrt(m1/m2), which in this

假設方塊的質量比為 100：1

• example is -10. That would mean the tangent of this angle theta, opposite over adjacent,

別忘了，這條動量守恆線的上升量除以橫移量的 斜率的值為 -√(m1/m2)

• is that run over the negative rise, which is 1/10 in this example. So theta = arctan(1/10).

在這個例子中，該值為 -10

• In general, it'll be the inverse tangent of the square root of the small mass over

這代表著 tan(θ) 也就是對邊除以鄰邊 將會是上升量除以負的橫移量

• the square root of the big mass.

在這例子中，該值為1/10

• If you go an plug these into a calculator, you'll notice that the arctan of each such

所以 θ = arctan(1/10)

• small value is quite close to the value itself. For example, arctan(1/100), corresponding

更明確的說， θ 會是 小質量除以大質量的平方根的反正切值(arctan)

• to a big mass of 10,000 kilograms, is extremely close to 0.01.

如果你用計算機輸入這些數值 你會發現這些反正切值會跟質量比值的平方根很接近

• In fact, it's so close that for the sake of our central question, it might as well

舉個例子， arctan(1/100) 對應到了大質量為 10,000 kg

• be 0.01. That is, analogous to what we saw a moment ago, adding this to itself 314 times

該值會非常接近 0.01

• won't surpass pi, but the 315th time would. Remember, unraveling why we're doing this,

事實上，為了解開我們最主要的問題 可以將它看成 0.01

• that's a way of counting how many of our jumps on the phase diagram gets to the end

也就是說，就像剛剛看到的那樣 把它加到314次

• zone, which is a way of counting how many times the blocks collide until they're sailing

該值還是不會超過 π 但如果加到315次，則會大於 π

• off never to touch again. So that's why a mass ratio of 10,000 gives 314 collisions.

別忘了，我們現在正在做的 是在計算於相圖中，在結束區域前發生了多少次跳躍

• Likewise a mass ratio of 1,000,000 to 1 will give an angle of arctan(1/1,000) in our diagram.

也就是在計算方塊發生了多少次的碰撞

• This is extremely close to 0.001. And again, if we ask about the largest integer multiple

我的朋友，這就是為什麼當質量比值為10,000時 會發生314次的碰撞

• of this theta that doesn't surpass pi, it's the same as it would be for the precise value

同樣方法，當質量比為 1,000,000：1 時 角度 θ 的值會是 arctan(1/1,000)

• of 0.001: 3,141. These are the first four digits of pi, because that is by definition

這個值會非常的接近 0.001

• what the digits of pi mean. This explains why with a mass ratio of 1,000,000, the number

一樣，我們要找出在不大於 π 的情況下 角度 θ 的最大整數倍是多少

• of collisions is 3,141.

而該角度 θ 可以視為 0.001

• All this relies on the hope that the arctan of a small value is sufficiently close to

最大整數倍會是 3,141 也就是定義上 π 的前四個數字

• the value itself, which is another way of saying that the tangent of a small value is

這解釋了為什麼當質量比值是1,000,000時 碰撞次數是 3,141 次

• approximately that value. Intuitively, there's a nice reason this is true. Looking at a unit

你或許會發現，這一切都是因為小數值的反正切值 會跟它本身非常接近

• circle, the tangent of any given angle is the height of this little triangle divided

也可以講成，小數值的正切值(tan) 大約等於它本身

• by its width. When that angle is really small, the width is basically 1, and the height is

有個非常直觀的原因來解釋為何會這樣

• basically the same as the arc length along the circle, which by definition is theta.

如果有個單位圓 某個角度的正切值會等於這個小三角形的高除以底

• To be more precise about it, the Taylor series expansion of tan(theta) shows that this approximation

當角度非常小的時候 底的長度會是 1 ，也就是圓的半徑

• will only have a cubic error term. So for example, tan(1/100) differs from 1/100 by

而高的長度基本上會是圓弧的弧長 根據定義該弧長等於 θ

• something on the order of 1/1,000,000. So even if we consider 314 steps with this angle,

更精確點的話 tan(θ) 的泰勒級數展開式當中

• the error between the actual value of arctan(1/100) and the approximation of 0.01 won't have

只會有立方項的誤差項 舉個例子來說

• a chance to accumulate enough to be significant.

tan(1/100) 與 1/100 只差了約 1/1,000,000 所以當我們在算該角度的跳躍數時

• So, let's zoom out and sum up: When blocks collide, you can figure out how their velocities

實際值 arctan(1/100) 與大約值 1/100 之間的誤差 不會大到影響該最大整數倍

• change by slicing a line through a circle in a velocity phase diagram, each curve representing

好的，先總結一下 當方塊碰撞的時候

• a conservation law. Most notably, the conservation of energy plants the circular seed that ultimately

你可以在速度的相圖中的圓上畫一條直線 來了解碰撞後的速度情形

• blossoms into the pi we find in the final count.

而這個圓和直線都代表著不同的守恆定律

• Specifically, due to some inscribed angle geometry, the points we hit of this circle

特別要注意的是，能量守恆定律的圓

• are spaced out evenly, separated by the angle we were calling 2*theta. This lets us rephrase

是為什麼最後會有 π 的主要原因

• the question of counting collisions as instead asking how many times we must add 2*theta

明確來說，由於圓周角定理 圓上的每個點都將圓平均的分割

• to itself before it surpasses 2pi.

都以 2θ 的角度分隔開

• If theta looks like 0.001, the answer to that question has the same first digits as pi.

因為這點，我們的問題從計算碰撞次數

• And when the mass ratio is some power of 100, because arctan(x) is so well approximated

變成了我們可以加幾次 2θ 而都不會超過 2π

• by x for small values, theta is sufficiently close to this value to give the same final

如果 θ 是 0.001 則該問題的解答會與 π 的前4位數字相同

• count. Setup for next video

如果當質量的比值是100的某次方時 由於 x 極小的情況下 arctan(x) 會約等於 x

• I'll emphasizes again what this phase space allowed us to do, because this is a lesson

因此 θ 會大約等於 arctan(θ) 所以答案不會影響

• useful for all sorts of math, like differential equations, chaos theory, and other flavors

我要再次強調相空間可以讓我們做到哪些事情

• of dynamics: By representing the relevant state of your system as a single point in

因為像我剛說的，相空間在各種的數學領域中都用的到 像是微分方程、混沌理論，以及其他種類的動力學

• an abstract space, it lets you translate problems of dynamics into problems of geometry.

它將一個系統中的相關狀態轉化在抽象空間成單一的點 讓問題從動力學問題變成了幾何學問題

• I repeat myself because I don't want you to come away just remembering a neat puzzle

我再重複一次是因為我不希望你離開時，只記得 「為什麼 π 會出現在令人意想不到的地方」的美麗題目

• where pi shows up unexpectedly, I want you to think of this surprise appearance as a

我希望你也不要忘記 這道題目背後更深層的關係

• distilled remnant of the deeper relationship at play.

如果這個解答讓你很滿意的話 那就不應該了，因為還有另外一種解法

• And if this solution leaves you feeling satisfied, it shouldn't. Because there is another perspective,

比這個解法還要更聰明、更漂亮 Galperin 在他的原始論文中

• more clever and pretty than this one, due to Galperin in the original paper on this

提到了要我們在「方塊的運動情形」 與「光束在兩個鏡子間的反射情況」兩者做比較

• phenomenon, which invites us to draw a striking parallel between the dynamics of these blocks,

相信我，我已經省略很多了

• and that of a beam of light bouncing between two mirrors. Trust me, I've saved the best

所以希望能在下一個影片再次看到你

• for last on this topic, so I hope to see you again next video.

Last video I left you with a puzzle. The setup involves two sliding blocks in a perfectly

B2 中高級 中文 美國腔 方塊 座標 動量 質量 速度 牆壁

# 為什麼碰撞塊會計算pi？ (Why do colliding blocks compute pi?)

• 65 1
kelly 發佈於 2021 年 01 月 14 日