Try   HackMD

Lecture 4 彈性碰撞 完整作業參考解法

建國高中特色選修課程 - 物理現象的程式設計與模擬
作者:賴奕帆
日期:2018/7/25

  • 同學們,在看參考解之前,請先想清楚自己是否真的有花時間想過如何寫課堂作業和進階作業了呢?

  • 學習無他,但求自己覺得好玩而已。

  • 若真的想把一件事情學好,務必花時間才能掌握。

  • 希望這邊的作業參考解法,真的都只是讓同學們拿來參考,而不是為了繳交作業的複製貼上。

  • 想過了嗎? 那請認真參考吧。

Lecture 4 作業

檢核作業 4-1

一維碰撞中最基本的物理概念是

  • 碰撞前後遵守動量守恆(含碰撞過程中),即

P=mAvA+mBvB=mAvA+mBvB=const.

  • 碰撞前後遵守動能守恆(不含碰撞過程中),即
    12mAvA2+12mBvB2=12mAvA2+12mBvB2

前述圖表只表現出碰撞過程中的位置、速度與加速度而已,請嘗試用圖表討論碰撞過程中的總動量與總力學能(含動能與彈力位能)如何變化。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

檢核作業 4-1 參考解法步驟 :

  1. 在畫面設定處,更改圖表設定,能量部分準備畫出總動能
    K=12m1v12+12m2v22
    、彈力位能
    U=12kΔx2
    與總力學能
    E=K+U
    三條曲線;動量部分準備畫出紅球動量
    P1
    、藍球動量
    P2
    與總動量
    P=P1+P2
"""更改圖表 (2. 畫面設定)""" E_t = graph(align='left',width=333,height=300, #畫E-t圖 title='K-purple , U-green , E-black', xtitle='t', ytitle='E', foreground=color.black,background=color.white, xmax=8, xmin=0, ymax=45, ymin=0) f4_1 = gcurve(color=color.purple) f4_2 = gcurve(color=color.green) f4_3 = gcurve(color=color.black) P_t = graph(align='left',width=333,height=300, #畫P-t圖 title='P1-red , P2-blue , P-black', xtitle='t', ytitle='P', foreground=color.black,background=color.white, xmax=8, xmin=0, ymax=20, ymin=0) f5_1 = gcurve(color=color.red) f5_2 = gcurve(color=color.blue) f5_3 = gcurve(color=color.black)
  1. 在執行迴圈處,計算兩球任意瞬間的動能、彈力位能、總力學能和動量等。
"""計算兩球任意瞬間的動能、彈力位能、總力學能和動量等(3. 執行迴圈)""" K = 0.5*m1*_________ + 0.5*m2*_________ U = 0.5*spring_k*(spring_L - mag(spring.axis))**2 E = K+U P1 = m1*ball1.v.x P2 = m2*ball2.v.x P = P1+P2
  1. 在執行迴圈處,將算出的能量與動量匯入圖表之中
"""將算出的能量與動量匯入圖表之中(3. 執行迴圈)""" f4_1.plot( pos=(t,K)) f4_2.plot( pos=(t,U)) f4_3.plot( pos=(t,E)) f5_1.plot( pos=(t,P1)) f5_2.plot( pos=(t,P2)) f5_3.plot( pos=(t,P))
  • 碰撞過程中有動能與動量守恆嗎? 碰撞前後有動能與動量守恆嗎?

檢核作業 4-2

撞球中,由於兩球的質量相同,且當子球(藍色球)靜止時,碰撞後兩球的夾角

ϕ=90

請利用三角函數把兩球碰撞後的夾角,利用程式計算出來,看看是否為90度吧。

檢核作業 4-2 參考解法步驟 :

  • 將下面程式碼貼在"三維碰撞"程式中的最後面。
  • 注意,此處設定4.0<t<4.1是計算碰撞後的角度,若你自己設定的位置不同,可能要適當調整。
  • 這裡有用到內積與反三角函數找角度的技巧,希望有能力的同學能自己查書理解。
"""計算兩球碰撞後的夾角是否為90度(3. 執行迴圈)""" if t>4.0 and t< 4.1: #注意此必須在碰撞結束後才計算角度 cos_theta = dot(ball1.v,ball2.v)/(ball1.v.mag*ball2.v.mag) theta = acos(cos_theta)*360/(2*pi) print (theta)

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • 注意,若希望兩球碰撞後的夾角為九十度,必須兩球的質量相同,且彈力常數不能太小。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • 若紅球質量大於藍球,你猜猜角度會大於還是小於90度呢? 請自己嘗試看看吧。

指定作業 4-1

Youtube : Stacked Ball Drop

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Stacked Ball Drp 是一個有名的科學網紅youtuber Physical girl拍攝的影片,她擺放了好幾顆球,使其垂直落下後彈跳極高的高度。

在一維碰撞(公式解)中,我們成功寫出了Y軸方向用公式的一維彈性碰撞,請嘗試改成三顆球依序擺放,且三球的質量、半徑與高度如下表所述,最後利用pre迴圈找出最上面的球會彈多高吧。

1
2
3
質量
m
m1=1
m2=5
m3=30
球半徑
r
r1=1
r2=2
r3=3
高度
y
y1=20
y2=17
y3=12

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

指定作業 4-1 參考解法步驟 :

  1. 在參數設定部分,設定好三球的基本參數。
""" 1. 參數設定 """ m1 = 1 ; m2 = 5 ; m3 = 30 ; g= 9.8 ; dt = 0.001 size1 = 1 ; size2 = 2 ; size3 = 3 height_1 = 20.0 ; height_2 = 17.0 ; height_3 = 12.0 """ 2. 畫面設定 """ scene = canvas(width=600, height=800,center = vec(0,height_1,0), background=vec(0.6,0.8,0.8)) #設定畫面 floor = box(length=40, height=0.01, width=10, color=color.blue) #畫地板 ball_1 = sphere(pos = vec( 0, height_1, 0), v = vec(0,0,0) , radius = size1, color=color.yellow ) #畫球 ball_2 = sphere(pos = vec( 0, height_2, 0), v = vec(0,0,0) , radius = size2, color=color.green ) #畫球 ball_3 = sphere(pos = vec( 0, height_3, 0), v = vec(0,0,0) , radius = size3, color=color.blue ) #畫球
  1. 三球均會受到重力作用自由落下,且球三碰到地板會反彈。
""" 3. 執行迴圈 """ while True: rate(1000) ball_1.pos += ball_1.v*dt ball_1.v.y += - g*dt ball_2.pos += ball_2.v*dt ball_2.v.y += - g*dt ball_3.pos += ball_3.v*dt ball_3.v.y += - g*dt if ball_3.pos.y <= size3 and ball_3.v.y < 0: ball_3.v.y = - 1* ball_3.v.y
  1. 利用三點紀錄法,找出球1彈跳至最高點的高度。
""" 2. 畫面設定 """ pre_ball_1_pos = vector(0,0,0) """ 3. 執行迴圈 """ while True: rate(1000) #每一秒跑 1000 次 pre_pre_ball_1_pos = pre_ball_1_pos pre_ball_1_pos = vector(ball_1.pos.x , ball_1.pos.y, ball_1.pos.z) """ 4. 最末端 """ if pre_ball_1_pos.y > pre_pre_ball_1_pos.y and pre_ball_1_pos.y > ball_1.pos.y : print (ball_1.pos.y)
  • 球1最高可至211公尺高,相當驚人的高度。
  • 同學可以隨意改動三球的質量,說不定球1可以飛到月球去喔。 XD