###### tags: `introduction of computer` # 期末專題-碰撞與$\pi$的關係 ## 專題說明 $\qquad$碰撞是高中物理的一部份,也是生活常見到的物理現象,請觀看以下以片,我們接下來來探討影片中的現象,便對其關係做延伸討論 影片網址:https://www.youtube.com/watch?v=HEfHFsfGXjs {%youtube HEfHFsfGXjs %} ## 分析原因 $\qquad$讓我們開始分析為何會有這樣的結果。首先,速度以右為正,並且我們標記最右側(質量較大)的方塊$a$質量為$m_1$,中間的方塊$b$質量為$m_2$,$a、b$接下來的速度標記為$v_{a_k}、v_{b_k}$以及初始速度為$v_{a_i}$,碰撞過程中變化的速度,並且假設全成為完全彈性碰撞。 $\qquad$根據動量守恆,我們在接下來的碰撞過程中可以得到下列結果。 \begin{gather*} m_1v_{a_k}+m_2v_{b_k}=m_1v_{a_i} \end{gather*} $\qquad$根據機械能守恆,我們在接下來的碰撞過程中可以得到下列結果。 \begin{gather*} \frac{1}{2}m_1v^2_{a_k}+\frac{1}{2}m_2v^2_{b_k}=\frac{1}{2}m_1v^2_{a_i} \end{gather*} $\qquad$因為為完全彈性碰撞,所以總動量與總動能恆為定值,我們分別標記為 $\qquad P_{total}=m_1v_{a_i}、E_{total}=\frac{1}{2}m_1v^2_{a_i}$ $\qquad$透過代數解法,我們可以知道之後的$v_{a_k}$跟$v_{b_k}$可以利用以下的公式表示,這有利於我們待會利用$C$語言去判別及計算碰撞次數。 \begin{gather*} v_{a_k}=\frac{m_1-m_2}{m_1+m_2}v_{a_{k-1}}+\frac{2m_2}{m_1+m_2}v_{b_{k-1}}~;~ v_{b_k}=\frac{2m_1}{m_1+m_2}v_{a_{k-1}}+\frac{m_2-m_1}{m_1+m_2}v_{b_{k-1}} \end{gather*} 其中$v_{a_0}=v_{a_i},~v_{b_0}=0, k~$為第幾次碰撞。 $\qquad$接下來我們利用幾何的解法來看這道問題,另$y=\sqrt{m_1}v_{a_k},~ x=\sqrt{m_2}v_{b_k}$,則總動量跟總動能則可以改寫成 \begin{gather*} \sqrt{m_1} y+\sqrt{m_2} x=P_{total}~;~y^2+x^2=2E_{total} \end{gather*} $\qquad$這很明顯是一條直線跟一個圓,而圓跟直線的焦點就是碰撞之前跟之後的結果,並且我們可以得到這張圖 +++![](https://i.imgur.com/hQzMPpf.jpg) 圖中的$\theta$為此直線傾角的補角,也是他截出來的圓弧的圓周角 $\qquad$接下來我們可以發現兩件事,第一,當$b$與牆壁碰撞時,$b$的速度與原先相同但方向相反;第二,所有$a,b$碰撞所創造出來的斜率跟其速度無關,只跟質量有關,斜率均為$-\frac{\sqrt{m_2}}{\sqrt{m_1}}$。並且,我們可以得到$\theta=\tan^{-1}\frac{\sqrt{m_2}}{\sqrt{m_1}}$並得到下列這張圖 圖中$\theta$與$\theta'$只有當最後一次碰撞的速度點為$(-v_{a_i},0)$才會相等,且當$\theta < \frac{\pi}{4}$的時候,$\theta > \theta'$(圖片僅供參考) +++![](https://i.imgur.com/PrC6IY6.jpg) 這時我們就可以連結碰撞與$\pi$的關係了,由途中$\theta$與圓弧的關係我們可以知道,碰撞過程中的圓弧角度均為$\theta$,且整個碰撞完所圍成的圓弧當$\theta < \frac{\pi}{4}$時,是小於$2\pi$的,而剩餘的圓弧是小於碰撞過程所產生的圓弧的,所以我們可以推導出下列式子(r為此圓半徑,N為碰撞次數) $2\theta r\times N < 2\pi r$ $2\theta r\times (N+1) > 2\pi r$ $\longrightarrow$ :::success $\frac{\pi}{\theta}-1 < N < \frac{\pi}{\theta}$ ::: 又$\theta=\tan^{-1}\frac{\sqrt{m_2}}{\sqrt{m_1}}$ :::success $\frac{\pi}{\tan^{-1}\frac{\sqrt{m_2}}{\sqrt{m_1}}}-1 < N < \frac{\pi}{\tan^{-1}\frac{\sqrt{m_2}}{\sqrt{m_1}}}$ ::: 這時,因為當$\theta\to 0,\tan\theta\approx\theta$,所以我們可以得到 :::success $\frac{\pi}{\frac{\sqrt{m_2}}{\sqrt{m_1}}}-1 < N < \frac{\pi}{\frac{\sqrt{m_2}}{\sqrt{m_1}}}$ ::: 因此 :::success \begin{gather*} N=\frac{\pi}{\frac{\sqrt{m_2}}{\sqrt{m_1}}}=\frac{\sqrt{m_1}}{\sqrt{m_2}}\pi(取整數部分 \end{gather*} ::: 所以碰撞次數才會出現$\pi$的小數點後幾位。各位可以利用下列程式碼是看看,你會發現這跟你輸入的速度數值無關,而跟質量方根比有關 :::warning 注意:碰撞次數為整數,所以它只會顯現出$\frac{\sqrt{m_1}}{\sqrt{m_2}}\pi$的整數部分 ::: ```cpp= #include<stdio.h> #include<stdlib.h> #define n 1 #define N 2 double collision(double M[n],double m[n],double V[N],double v[N]); int main() { double M[n] = { 0 }, m[n] = { 0 }, V[N] = { 0 }, v[N] = { 0 }; double T = 0; /*input the value of M,m,V*/ printf("Input the value of weight of square-a\n"); scanf_s("%lf", &M[0]); printf("Input the value of weight of square-b\n"); scanf_s("%lf", &m[0]); printf("Input the value of speed of square-a\n"); scanf_s("%lf", &V[0]); /*prevent the wrong value*/ if (M[0] <= 0) { printf("Please input the positive number\n"); scanf_s("%lf", &M[0]); } if (m[0] <= 0) { printf("Please input the positive number\n"); scanf_s("%lf", &m[0]); } if (V[0] >= 0) { printf("The time of collision is %lf \n",&T); printf("Please input the negative number\n"); scanf_s("%lf", &V[0]); } printf("--------\n"); /*compute the time of collision*/ int a = 1; printf("the initial V is %lf\n", V[0]); printf("the initial v is %lf\n", v[0]); printf("-------\n"); while (1) { if (V[0] >= 0 && v[0] >= 0 && V[0] >= v[0]) { printf("The time of collision is %lf \n",T); printf("the final V is %lf\n", V[0]); printf("the final v is %lf\n", v[0]); printf("-------\n"); break; } else if (V[0] <= 0 && v[0] >= 0) { ++T; collision(M,m,V,v); } else if (V[0] <= 0 && v[0] < 0) { ++T; v[1] = -v[0]; v[0] = v[1]; /*the value of speed*/ /* printf("the V is %lf\n", V[a]); printf("the v is %lf\n", v[a]); printf("-------\n"); */ } else if (V[0] >= 0 && v[0] < 0) { ++T; v[1] = -v[0]; v[0] = v[1]; /*the value of speed*/ /* printf("the V is %lf\n", V[a]); printf("the v is %lf\n", v[a]); printf("-------\n"); */ } else if (V[0] >= 0 && v[0] > 0 && V[0] < v[0]) { ++T; collision(M, m, V, v); } } system("pause"); return 0; } double collision(double M[n], double m[n], double V[N], double v[N]) { v[1] = (2 * M[0])*V[0] / (M[0] + m[0]) + (m[0]-M[0])*v[0] / (M[0] + m[0]); V[1] = (M[0] - m[0]) * V[0] / (M[0] + m[0]) + (2 * m[0])*v[0] / (M[0] + m[0]); v[0] = v[1]; V[0] = V[1]; /*the value of speed*/ /* printf("V is %lf\n", V[a]); printf("v is %lf\n", v[a]); printf("-------\n"); */ return 0; } ```