[关闭]
@rrtcc 2016-11-27T14:37:43.000000Z 字数 3507 阅读 42

第十次作业

行星运动


摘要

描述
在本次作业中,我们把目光投向太阳系,考虑在太阳系中行星运动的相关问题。与课本所述相互印证,探究对于变形的万有引力定律和水星进动的相关规律。

背景

考虑牛顿的万有引力定律


从牛顿第二定律有

利用AU(天文单位,天文学中测量距离,特别是测量太阳系内天体之间的距离的基本单位,地球到太阳的平均距离为一个天文单位。一天文单位约等于1.496亿千米),方程可以写为:

故可得到如下微分方程组

可以假设万有引力的形式如下

对轨道偏离最大的水星,其引力可近似为

正文

一.在不同β下的椭圆轨道模拟

  1. import matplotlib.pyplot as pl
  2. class PlanetOrbit:
  3. def __init__(self,time_step=0.001,init_x=1,init_y=0,init_vx=0,init_vy=1.3*math.pi,
  4. beta=2.10,T_a=0.998,eccentricity=0.017,total_time=2):
  5. self.Kep = 4*pow(math.pi,2)/T_a
  6. self.e = eccentricity
  7. self.dt = time_step
  8. self.r = []
  9. self.x = [init_x]
  10. self.y = [init_y]
  11. self.vx = [init_vx]
  12. self.vy = [init_vy]
  13. self.t = total_time
  14. self.power = beta + 1
  15. def Run(self):
  16. loop = True
  17. i = 0
  18. while(loop):
  19. self.r.append(pow(((self.x[i])**2+(self.y[i])**2),0.5))
  20. self.vx.append(self.vx[i]-(self.Kep*self.x[i]*self.dt)/(self.r[i]**self.power))
  21. self.x.append(self.x[i]+self.vx[i+1]*self.dt)
  22. self.vy.append(self.vy[i]-(self.Kep*self.y[i]*self.dt)/(self.r[i]**self.power))
  23. self.y.append(self.y[i]+self.vy[i+1]*self.dt)
  24. i += 1
  25. if (i>=(self.t/self.dt-1)):
  26. loop = False
  27. def DrawOrbit(self):
  28. pl.plot(self.x,self.y,label="beta = $self.beta$")
  29. pl.title('planet orbiting the Sun')
  30. pl.xlabel('x(AU)')
  31. pl.ylabel('y(AU)')
  32. pl.axis('equal' )
  33. pl.legend()
  34. pl.show()
  35. a=PlanetOrbit()
  36. a.Run()
  37. a.DrawOrbit()

结果如下
描述
描述
描述
描述
β=3.00时,如下
描述

二.在不同α下的水星轨道模拟(在进动条件下远日点的变化)

  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3. import math
  4. alfa=0.01
  5. x0=0
  6. y0=0
  7. xp=[]
  8. yp=[]
  9. tp=[]
  10. theta=[]
  11. class elliptical:
  12. def __init__(self,GMs=4*math.pi**2,dt=0.0001,time=2):
  13. self.GMs=GMs
  14. self.x=[0.47]
  15. self.y=[0]
  16. self.vx=[0]
  17. self.vy=[8.2]
  18. self.dt=dt
  19. self.time=time
  20. self.r=[math.sqrt(self.x[0]**2+self.y[0]**2)]
  21. self.t=[0]
  22. def calculate(self):
  23. for i in range(int(self.time//self.dt)):
  24. self.vx.append(self.vx[i]-self.GMs*self.x[i]*self.dt/self.r[i]**3-alfa*self.GMs*self.x[i]*self.dt/self.r[i]**5)
  25. self.vy.append(self.vy[i]-self.GMs*self.y[i]*self.dt/self.r[i]**3-alfa*self.GMs*self.y[i]*self.dt/self.r[i]**5)
  26. self.x.append(self.x[i]+self.vx[i+1]*self.dt)
  27. self.y.append(self.y[i]+self.vy[i+1]*self.dt)
  28. self.t.append(self.t[i]+self.dt)
  29. self.r.append(math.sqrt(self.x[i+1]**2+self.y[i+1]**2))
  30. def precession(self):
  31. for j in range(len(self.r)-2):
  32. if (self.r[j+1]**2-self.r[j]**2>0 and self.r[j+1]**2-self.r[j+2]**2>0):
  33. xp.append(self.x[j+1])
  34. yp.append(self.y[j+1])
  35. tp.append(self.t[j+1])
  36. if self.x[j+1]>=0 and self.y[j+1]/self.x[j+1]>=0:
  37. theta.append(math.atan(self.y[j+1]/self.x[j+1])*180/math.pi)
  38. if self.x[j+1]>=0 and self.y[j+1]/self.x[j+1]<0:
  39. theta.append(math.atan(self.y[j+1]/self.x[j+1])*180/math.pi+360)
  40. if self.x[j+1]<0 and self.y[j+1]/self.x[j+1]>=0:
  41. theta.append(math.atan(self.y[j+1]/self.x[j+1])*180/math.pi+180)
  42. if self.x[j+1]<0 and self.y[j+1]/self.x[j+1]<0:
  43. theta.append(math.atan(self.y[j+1]/self.x[j+1])*180/math.pi+180)
  44. def show_results(self):
  45. for j in range(len(xp)):
  46. plt.plot([0,xp[j]],[0,yp[j]])
  47. plt.plot(self.x,self.y,'g',label=r'$\alpha$=0.0008'+' trajectory')
  48. plt.scatter(x0,y0)
  49. plt.title(r'$\alpha$=0.0008'+' Simulation of the precession of Mercury ',fontsize=14)
  50. plt.xlabel(u'x(AU)',fontsize=14)
  51. plt.ylabel(u'y(AU)',fontsize=14)
  52. plt.legend(fontsize=14,loc='best')
  53. a=elliptical()
  54. a.calculate()
  55. a.precession()
  56. a.show_results()
  57. plt.show()

结果如下
远日点
描述
描述
3.Vpython
描述

结论

1.β越大,轨道的进动越明显
2.α越大,远日点的变化越明显

致谢

Professor Cai
The book of Computational Physics, chapter 4
Wikipedia

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注