Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3.  
  4. #Time
  5. T=[2.45452831948422E+006,2.45452837470377E+006,2.45452842543483E+006]
  6.  
  7. #Delta T
  8. Delta10=T[1]-T[0]
  9. Delta21=T[2]-T[1]
  10.  
  11. #Coordinates of the asteroid in degrees
  12. RA=[84.94302291666666,84.9599270833333,84.97283833333]
  13. DEC=[28.46809722222,28.4690725,28.4690725]
  14.  
  15. #Cartesian equatorial coordinates of the sun
  16. X=[0.94542896,0.94573013,0.946006096]
  17. Y=[-0.27358003,-0.272745277,-0.271978009]
  18. Z=[-0.11860989,-0.118247971,-0.11791531]
  19.  
  20. #Constants
  21. k=0.01720209895
  22.  
  23.  
  24. #Vector definition
  25. R=[]
  26. LA=[]
  27. MU=[]
  28. NU=[]
  29. i=0
  30. while i<3 :
  31. R.append(np.sqrt(X[i]**2+Y[i]**2+Z[i]**2)) #Vecteur Terre-Soleil
  32. LA.append(np.cos((DEC[i]))*np.cos(RA[i]))
  33. MU.append(np.cos((DEC[i]))*np.sin(RA[i]))
  34. NU.append(np.sin(DEC[i]))
  35. i=i+1
  36.  
  37.  
  38. N0=[LA[0],MU[0],NU[0]]
  39. N1=[LA[1],MU[1],NU[1]]
  40. N2=[LA[2],MU[2],NU[2]]
  41.  
  42. #Q calculation
  43. Qnum=Delta21*(LA[0]*(MU[1]*Z[1]-NU[1]*Y[1])+MU[0]*(NU[1]*X[1]-LA[1]*Z[1])+NU[0]*(LA[1]*Y[1]-MU[1]*X[1]))
  44. Qdenum=Delta10*(LA[1]*(MU[2]*Z[1]-NU[2]*Y[1])+MU[1]*(NU[2]*X[1]-LA[2]*Z[1])+NU[1]*(LA[2]*Y[1]-MU[2]*X[1]))
  45. Q=(Qnum/Qdenum)
  46. print('Q =',Q)
  47.  
  48. #Newton Method
  49.  
  50. DeltaC=[]
  51. ValD1=[]
  52. L=(LA[0]-Q*LA[2])**2+(MU[0]-Q*MU[2])**2+(NU[0]-Q*NU[2])**2
  53. M=2*((X[2]-X[0])*(LA[0]-Q*LA[2])+(Y[2]-Y[0])*(MU[0]-Q*MU[2])+(Z[2]-Z[0])*(NU[0]-Q*NU[2]))
  54. N=(X[2]-X[0])**2+(Y[2]-Y[0])**2+(Z[2]-Z[0])**2
  55.  
  56. i=0
  57. imax=50000
  58. D1=0
  59. eps=1e-6
  60. while i<imax:
  61. #r1 & r2 calculation
  62. r1=np.sqrt(D1*D1-2*D1*(LA[0]*X[0]+MU[0]*Y[0]+NU[0]*Z[0])+R[0]*R[0])
  63. r3=np.sqrt(Q*Q*D1*D1-2*Q*D1*(LA[2]*X[2]+MU[2]*Y[2]+NU[2]*Z[2])+R[2]*R[2])
  64. #PHi calculation
  65. PHInum=2*k*(T[2]-T[0])
  66. PHIdenum=(r1+r3)**(3/2)
  67. PHI=PHInum/PHIdenum
  68. #First value of c
  69. c1=np.sqrt(L*D1*D1+M*D1+N)
  70. #Second value of c
  71. c2=(r1+r3)*PHI*(1+(1/24)*PHI*PHI+(5/384)*PHI*PHI*PHI*PHI+(59/9216)*PHI**6)
  72. DeltaC.append(c1-c2)
  73. ValD1.append(D1)
  74. D1=D1+0.000001
  75. i=i+1
  76. if abs((c1-c2))<= eps :
  77. print('r1 =',r1);
  78. print('r2 =',r3);
  79. print('D1 =',D1);
  80. print('D3 =',Q*D1)
  81. print('c2-c1 =',(c2-c1))
  82. D3=Q*D1
  83. break
  84.  
  85. #plt.plot(ValD1,DeltaC)
  86. #plt.show()
  87.  
  88. #sun-asteroid vector
  89. vr1=[LA[0]*D1-X[0],MU[0]*D1-Y[0],NU[0]*D1-Z[0]];
  90. vr3=[LA[2]*D3-X[2],MU[2]*D3-Y[2],NU[2]*D3-Z[2]];
  91. eps=(23.43929111111111); #Degres
  92. vr1bis=[vr1[0],vr1[1]*np.cos(eps)+vr1[2]*np.sin(eps),-vr1[1]*np.sin(eps)+vr1[2]*np.cos(eps)];
  93. vr3bis=[vr3[0],vr3[1]*np.cos(eps)+vr3[2]*np.sin(eps),-vr3[1]*np.sin(eps)+vr3[2]*np.cos(eps)];
  94.  
  95. vC=[vr1bis[1]*vr3bis[2]-vr1bis[2]*vr3bis[1],vr1bis[2]*vr3bis[0]-vr3bis[2]*vr1bis[0],vr1bis[0]*vr3bis[1]-vr3bis[0]*vr1bis[1]];
  96. C=np.sqrt(vC[0]**2+vC[1]**2+vC[2]**2);
  97.  
  98. #Inclinaison
  99. I=np.arccos(vC[2]/C);
  100.  
  101. #Longitude of the ascending node
  102. ohm=np.arctan(-vC[0]/vC[1]);
  103.  
  104. #distance to perihelion calculation
  105. qnum=r1*r3*np.sin((NU[2]-NU[0])/2)**2
  106. qdenum=r1+r3-2*np.sqrt(r1*r3)*np.cos((NU[2]-NU[0])/2);
  107. q=qnum/qdenum;
  108.  
  109. #perihelion To calculation
  110. s=np.tan(NU[0]/2);
  111. To=T[0]-(np.sqrt(2)*q**(3/2)/k)*(s**3/3+s);
  112. print('Inclinaison',I,'°')
  113. print('Longitude du neoud ascendant',ohm,'°')
  114. print('Distance au périhélie',q,'UA')
  115. print('Passage au périhélie',To)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement