πŸ“œ ⬆️ ⬇️

Building orbits of celestial bodies by means of Python



Reference Systems for Determining Orbits


To find the trajectories of relative motions in classical mechanics, we use the assumption of absolute time in all reference systems (both inertial and non-inertial).

Using this assumption, we consider the motion of the same point in two different reference systems. K and Kβ€² of which the second moves relative to the first with an arbitrary speed  v e c V ( t ) = d o t v e c R ( t )   where  v e c R ( t ) radius vector describing the position of the origin point of the coordinate system Kβ€² relative to the reference system K ).
')
We will describe the motion of a point in the system. Kβ€² radius vector  v e c rβ€² (T) directed from the origin of the system Kβ€² at the current position of the point. Then the motion of the considered point relative to the reference system K described by radius vector  v e c r ( t ) :

 v e c r ( t ) = v e c r β€² (T)+vecR(t)  , (one)

and relative speed  vecv(t)

 vecv(t)= dot vecrβ€²(t)+ dot vecR(t) , (2)

Where  dot vecrβ€²(t) - point speed relative to the system Kβ€² ;  dot vecR(t) - speed of movement of the reference system Kβ€² relative to the reference system K .



Thus, to find the law of motion of a point in an arbitrary frame of reference K it is necessary:

1) set the law of motion of a point -  vecrβ€²(t) relative to the reference system Kβ€² ;
2) set the law of motion -  vecR(t) reference systems Kβ€² relative to the reference system K
3) to determine the law of motion of a point -  vecr(t)= vecrβ€²(t)+ vecR(t) relative to the reference system K .

Construction of the Moon's orbit in the heliocentric reference system





In the heliocentric reference system (system K ) The earth moves in a circle of radius
R1=1,496 cdot108 km (period of circulation T1=3.156 cdot107 with.). The moon, in turn, moves around the Earth (system K ') around a circle of radius R2=3,844 cdot105 km (circulation period T2=2.36 cdot106 with. As is known [1,2], when a material point moves along a circle of radius R with constant angular velocity  omega The coordinates of the radius vector drawn from the origin to the current position of the point vary according to the law:

 vecR(t)= binomR cdotcos( omega cdott+ varphi0)R cdotsin( omega cdott+ varphi0)= binomR cdotcos( frac2 piT)+ varphi0)R cdotsin( frac2 piT+ varphi0),(3)



Where  varphi0 - the initial phase characterizing the position of the particle at the moment of time t=0 which we will assume to be zero later on. Replacing in (3) R on R1 and R2 and substituting in (1), we obtain the dependence of the radius vector of the Moon in the heliocentric coordinate system on time:

 vecr(t)= binomx(t)y(t)= binomR2cos( frac2 piT2t)+R1cos( frac2 piT1t)R2sin( frac2 piT2t)+R1sin( frac2 piT1t),(4)



Expression (4) sets the moon's orbit ( y=y(x(t)) ) in parametric form, where the parameter is time. To build the desired orbit by means of Python, we define the radii of the orbits and the periods of rotation of the Earth and the Moon.

The earth moves in the heliocentric coordinate system ( K ) its orbit radius and orbital period are respectively equal R1=1,496 cdot108km,T1=3,156 cdot107s . The moon moves around the earth in the coordinate system ( Kβ€² ) its orbit radius and orbital period are respectively equal R2=3.844 cdot105km,T2=2.36 cdot106s .

Taking into account (4), we define the functions of dependence of coordinates on time:

 binom(X(t)=R1 cdotcos( frac2 piT1 cdott),Y(t)=R1 cdotsin( frac2 piT1 cdott)x(t)=R2 cdotcos( frac2 piT2 cdott),y(t)=R2 cdotsin( frac2 piT2 cdott),(5)



Using (5), we obtain a pair of coordinates for the moon's orbit:

 binomXg(t)=X(t)+x(t)Yg(t)=Y(t)+y(t),(6)



Let us set the number of points where coordinates N = 1000 and discrete time are calculated on the interval of the period of rotation of the Earth dt= fracT1N . We write a program and build a graph for a positive coordinate change area:

Determination of the orbits of the Earth and the Moon
from numpy import* from matplotlib.pyplot import* R1=1.496*10**8#       [6] T1=3.156*10**7 R2=3.844*10**5 T2=2.36*10**6 N=1000.0 def X(t): return R1*cos(2*pi*t/T1) def Y(t): return R1*sin(2*pi*t/T1) def x(t): return R2*cos(2*pi*t/T2) def y(t): return R2*sin(2*pi*t/T2) k=100 t=[T1*i/N for i in arange(0,k,1)] X=array([X(w) for w in t]) Y=array([Y(w) for w in t]) x=array([x(w) for w in t]) y=array([y(w) for w in t]) XG=X+x YG=Y+y figure() title("    .\n    ") xlabel('$X(t_{k})$,$X_{g}(t_{k})$') ylabel('$Y(t_{k})$,$Y_{g}(t_{k})$') axis([1.2*10**8,1.5*10**8,0,1*10**8]) plot(X,Y,label=' ') plot(XG,YG,label=' ') legend(loc='best') grid(True) show() 

We get:


Pic1

The created schedule allows you to expand the learning task and see what the moon's orbit will be if the radius of the moon's orbit is equal to R2=3,844 cdot107 . . To the reader, even without special knowledge of astronomy, it is clear that the Moon cannot have such an orbit in the non-field of the Earth, but a hypothetical radius is used to study the conditions of the occurrence of loops . Make the appropriate changes to the program:

Determination of the orbits of the Earth and the Moon
studying
  from numpy import* from matplotlib.pyplot import* R1=1.496*10**8#       [6] T1=3.156*10**7 R2=3.844*10**7 T2=2.36*10**6 N=1000.0 def X(t): return R1*cos(2*pi*t/T1) def Y(t): return R1*sin(2*pi*t/T1) def x(t): return R2*cos(2*pi*t/T2) def y(t): return R2*sin(2*pi*t/T2) t=[T1*i/N for i in arange(0,N,1)] X=array([X(w) for w in t]) Y=array([Y(w) for w in t]) x=array([x(w) for w in t]) y=array([y(w) for w in t]) XG=X+x YG=Y+y figure() title("    ") xlabel('$X(t_{k})$,$X_{g}(t_{k})$') ylabel('$Y(t_{k})$,$Y_{g}(t_{k})$') axis([-2.0*10**8,2.0*10**8,-2.0*10**8,2.0*10**8]) plot(X,Y,label=' ') plot(XG,YG,label=' ') legend(loc='best') grid(True) show() 


We get:


Pic2

Comparing the orbits of the moon presented in Fig. 1 and 2, we find their significant differences. To explain the reason for these differences, it is necessary to compare the linear velocities of the Moon in the first and second cases and the linear velocity of the Earth.

Since the direction of the linear velocity of the Earth relative to the Sun, as well as the direction of the linear velocity of the Moon relative to the Earth, changes over time, and the speed remains constant in magnitude.

As a quantitative characteristic of the ratio of the linear velocities of the Moon and Earth in the heliocentric coordinate system, choose the difference between the module of the linear velocity of the Earth and the projection of the linear velocity of the Moon on the direction of the vector of the linear velocity of the Earth:

vo(t)= left| vecV(t) right|βˆ’ frac( vecV(t) cdot vecv(t)) left| vecV(t) right|,(7)



Define the functions that describe the laws of changes in the components of the velocity of the Earth and the Moon:

\ begin {matrix} V_ {x} (t) = \ frac {d} {dt} X (t), V_ {y} (t) = \ frac {d} {dt} Y (t) & \\ vx (t) = \ frac {d} {dt} x (t), vy (t) = \ frac {d} {dt} y (t) \ end {matrix}, (8)



To determine the resulting speed, taking into account the projection, we use the relation:

D(t)= sqrtVx(t)2+Vy(t)2βˆ’ sqrtvx(t)2+vy(t)2 cdot fracVx(t) cdotvx(t)+Vy(t) cdotvy(t) sqrtVx(t)2+Vy(t)2 cdot sqrtvx(t)2+vy(t)2,(9)

We write the program taking into account (5), (8), (9) and the radius of the orbit of the moon R2=3,844 cdot105 km:

The moon and the earth are moving in the same direction
 from numpy import* from matplotlib.pyplot import* R1=1.496*10**8#       [6] T1=3.156*10**7 R2=3.844*10**5 T2=2.36*10**6 N=1000.0 k1=2*pi/T1 k2=2*pi/T2 def Vx(t): return -k1*R1*sin(k1*t) def Vy(t): return k1*R1*cos(k1*t) def vx(t): return -k2*R2*sin(k2*t) def vy(t): return k2*R2*cos(k2*t) def D(t): return sqrt(Vx(t)**2+Vy(t)**2)-sqrt(vx(t)**2+vy(t)**2)*(Vx(t)*vx(t)+Vy(t)*vy(t))/((sqrt(Vx(t)**2+Vy(t)**2))*(sqrt(vx(t)**2+vy(t)**2))) x=[T1*i/N for i in arange(0,N,1)] y=[D(t) for t in x] title("       \n    R2=3.844*10**5 .") xlabel('t') ylabel('D(t)') plot(x,y) show() 


We get:


Fig.3.

Let's write the program taking into account (5), (8), (9) and the radius of the Moon's orbit R2 = 3.844 * 10 ** 7 km:

The moon periodically moves in the opposite direction to Earth.
 from matplotlib.pyplot import* R1=1.496*10**8#       [6] T1=3.156*10**7 R2=3.844*10**7 T2=2.36*10**6 N=1000.0 k1=2*pi/T1 k2=2*pi/T2 def Vx(t): return -k1*R1*sin(k1*t) def Vy(t): return k1*R1*cos(k1*t) def vx(t): return -k2*R2*sin(k2*t) def vy(t): return k2*R2*cos(k2*t) def D(t): return sqrt(Vx(t)**2+Vy(t)**2)-sqrt(vx(t)**2+vy(t)**2)*(Vx(t)*vx(t)+Vy(t)*vy(t))/((sqrt(Vx(t)**2+Vy(t)**2))*(sqrt(vx(t)**2+vy(t)**2))) x=[T1*i/N for i in arange(0,N,1)] y=[D(t) for t in x] title("        \n .    R2=3.844*10**7 .") xlabel('t') ylabel('D(t)') plot(x,y) show() 


We get:


Fig.4.

Dependency analysis allows us to explain the reason for differences in orbits. D (t) function with R2=3,844 cdot105 km is always positive, i.e. the moon always moves in the direction of the Earth’s motion and no loops form. With R2=3,844 cdot107 km magnitude D(t) takes negative values, and there are times in which the moon moves in the opposite direction of the Earth’s motion, and therefore the orbit has loops. That was the meaning of using the non-existent orbit of the Moon in the calculations.

The construction of the orbit of Mars in the reference system associated with the Earth

.


In the heliocentric reference system (system K), the Earth moves around a circle of radius R1=1,496 cdot108 km, period of circulation T1=$365.2 day, Mars moves along an ellipse, the semi-major axis of which am=2.28 cdot108 km, the period of revolution of Mars Tm=$689.9 day., eccentricity of the orbit e=0,093 [3]. The motion of the Earth is described by the radius vector R (t) given by expression (3). Due to the fact that the orbit of Mars is an ellipse, the dependencies x=x(t),y=y(t) from time are set parametrically [4]:

x( varepsilon)=am cdot(cos( varepsilon)βˆ’e) , (ten)

y( varepsilon)=am cdot sqrt1βˆ’e2 cdotsin( varepsilon) , (eleven)

t( varepsilon)= fracTm2 pi cdot( varepsilonβˆ’e cdotsin( varepsilon)) , (12)

A complete ellipse turn corresponds to a change in the parameter <img  varepsilon from 0 to 2 pi . To build the orbit of Mars, at the same time, it is necessary to calculate the coordinates of the radius vectors describing the position of the Earth and Mars in the heliocentric frame of reference, then in accordance with the relation  vecrβ€²(t)= vecr(t)βˆ’ vecR(t) calculate the coordinates of Mars in the reference system associated with the Earth.

To build the orbit of Mars in the reference system associated with the Earth, we use the previously given parameters of the orbits of the Earth and Mars, relations (10) - (12), as well as relations for the coordinates of the Earth:

X(t)=R1 cdotcos( frac2 piT1t) , (13)

Y(t)=R1 cdotsin( frac2 piT1t) ,(14)

It should be noted that the number of periods of rotation of Mars around the Sun is equal to K=9 , then the number of points at which the calculation should be made and the distance between them will be determined from the relations:

N=4000 cdotK, varepsiloni= frac2 piN cdoti,i=0...N (15)

Mars orbit in the Earth's reference system
 from numpy import* from matplotlib.pyplot import* R1=1.496*10e8#       [4] T1=365.24 am=2.28*10e8 Tm=689.98 ee=0.093 N=36000 def x(g): return am*(cos(g)-ee) def y(g): return am*sqrt(1-ee**2)*sin(g) def t(g): return Tm*(g-ee*sin(g))/2*pi def X(g): return R1*cos(2*pi*t(g)/T1) def Y(g): return R1*sin(2*pi*t(g)/T1) y=array([y(2*pi*i/N) for i in arange(0,N,1)]) x=array([x(2*pi*i/N) for i in arange(0,N,1)]) X=array([X(2*pi*i/N) for i in arange(0,N,1)]) Y=array([Y(2*pi*i/N) for i in arange(0,N,1)]) t=array([t(2*pi*i/N) for i in arange(0,N,1)]) figure() title("    ") xlabel('x(g),X(g)') ylabel('y(g),Y(g)') plot(x,y,label=' ') plot(X,Y,label=' ') legend(loc='best') figure() title("       ") xlabel('x1/10e8') ylabel('y1(g/10e8') x1=(xX) y1=(yY) plot(x1/10e8,y1/10e8) figure() title("      \n    ") xlabel('t/365.24') ylabel('sqrt(x1**2+y1**2)/10e8') y2=sqrt(x1**2+y1**2)/10e8 x2=t/365.24 plot(x2,y2) show() 


We get:


Pic.5

Calculate the coordinates of the radius vector describing the position of Mars in the reference system associated with the Earth, and build orbits (Fig. 6) using the relation:

x1i=x( varepsiloni)βˆ’X(t( varepsiloni)),y1i=y( varepsiloni)βˆ’Y(t( varepsiloni)) (sixteen)


Pic.6

Another important characteristic of the motion of Mars (primarily for interplanetary space flights) is the distance between the Earth and Mars s (t), which is determined by the module of the radius vector describing the position of Mars in the reference system associated with the Earth. The dependence of the distance between the Earth and Mars on time, measured in Earth years, is shown in Fig.7.


Fig.7

The analysis of the dependence presented in Fig. 7 shows that the distance between the Earth and Mars is a complex periodic function of time. If we use the terminology of the theory of signals [5], then the dependence s (t) can be said that it is an amplitude-modulated signal, which is usually represented as a product of two functions of the high-frequency (carrier) and low-frequency function, which specifies the amplitude modulation (envelope) :

u(t)=( baru+a cdotsin( omega1t)) cdot(1+ Deltaa cdotsin( omega2t)) (17)

Where  baru - constant component of the function u(t) ; a - signal amplitude;  o m e g a 1 - carrier frequency;  D e l t a a - the amplitude of the function that specifies the depth of amplitude modulation;  o m e g a 2 - frequency of the modulating function.

It is seen from Fig. 7 that the carrier period is approximately 2 years, the period of the modulating function is approximately 17 years] 6].

Creation of the heliocentric orbit of Halley's comet




The last time Halley's comet passed through its perihelion (the point of the orbit closest to the Sun) was on February 9, 1986. (The Sun itself is considered to be located at the origin.)

The coordinates and velocity components of Halley’s comet at that moment were equal p 0 = ( 0.325514 , 0.459460 , 0.166229 ) and v0=(–9.096111,–6.916686,–1.305721) accordingly, the distance here is expressed in astronomical units of length - AU, or simply AU (an astronomical unit, i.e., the length of the major major semiaxis of the earth's orbit), and time β€” in years. In these units, the three-dimensional equations of motion of the comet are:

\ left \ {\ begin {matrix} \ frac {d ^ {2} x} {dt ^ {2}} = - \ frac {\ mu \ cdot x} {r ^ {3}} \\ \ frac { d ^ {2} y} {dt ^ {2}} = - \ frac {\ mu \ cdot y} {r ^ {3}} \\ \ frac {d ^ {2} z} {dt ^ {2} } = - \ frac {\ mu \ cdot z} {r ^ {3}} \ end {matrix} \ right., (18)

(18)

Where:  mu=4 pi2,r= sqrtx2+y2+z2

Creation of the heliocentric orbit of Halley's comet
 from numpy import* from scipy.integrate import odeint import matplotlib.pyplot as plt from matplotlib.patches import Circle def f(y, t): y1, y2, y3, y4,y5,y6 = y return [y2, -(4*pi*pi*y1)/(y1**2+y3**2 +y5**2)**(3/2),y4,-(4*pi*pi*y3)/(y1**2+y3**2 +y5**2)**(3/2),y6,-(4*pi*pi*y5)/(y1**2+y3**2 +y5**2)**(3/2)] t = linspace(0,300,10001) y0 = [0.325514,-9.096111, -0.459460,-6.916686,0.166229,-1.305721] [y1,y2, y3, y4,y5,y6]=odeint(f, y0, t, full_output=False).T fig, ax = plt.subplots() plt.title("  (  ..,   ) \n    ") plt.xlabel('x(t)') plt.ylabel('y(t)') fig.set_facecolor('white') ax.plot(y1,y3,linewidth=1) circle = Circle((0, 0), 0.2, facecolor='orange') ax.add_patch(circle) plt.axis([1,-21,-1,29]) plt.grid(True) fig, ax = plt.subplots() plt.title("   \n    ") plt.xlabel('x(t)') plt.ylabel('z(t)') fig.set_facecolor('white') ax.plot(y1,y5,linewidth=1) circle = Circle((0, 0), 0.1, facecolor='orange') ax.add_patch(circle) plt.axis([1,-21,1,-11]) plt.grid(True) fig, ax = plt.subplots() plt.title("   \n    ") plt.xlabel('y(t)') plt.ylabel('z(t)') fig.set_facecolor('white') ax.plot(y3,y5,linewidth=1) circle = Circle((0, 0), 0.2, facecolor='orange') ax.add_patch(circle) plt.axis([-1,29,1,-11]) plt.grid(True) fig, ax = plt.subplots() plt.title("     \n   ZOX  ZOY ") ax.plot(t,y1,linewidth=1) ax.plot(t,y3,linewidth=1) plt.show() 


We get:









Your own comet

Try an experiment. At night, you set up your telescope on a peak, not far from your home’s elevation. The night should be clear, cloudless, stellar, and if fortune smiled at you: at 0.30 am you will notice a new comet.

After repeated observations on the following nights, you will be able to calculate its coordinates on that first night. Coordinates in the heliocentric coordinate system: P0 = (x0, y0, z0) and the velocity vector v0 = (vx0, vy0, vz0).

Using this data, determine:


If you measure the distance in astronomical units, and time - in years, then the equation of motion of the comet will take the form (18). For your own comet, choose arbitrary starting coordinates and velocities of the same order as that of comet Halley.

If necessary, re-perform an arbitrary choice of the initial position and velocity vector until you get a plausible eccentric orbit that goes beyond the limits of the Earth's orbit (like most true comets).

References:


  1. Feynman R., Leighton R., Sands M. The Feynman Lectures on Physics. 3rd ed. T. 1.-2. M .: Mir, 1977.
  2. Matveev A. N. Mechanics and Theory of Relativity. M .: Higher. shk., 1986.
  3. Physical Encyclopedia. T. 3. M .: Great Russian Encyclopedia, 1992.
  4. Landau L. D., Lifshits E. M. The course of theoretical physics. Mechanics. M .: Fyut-Matgiz, 1958.
  5. Baskakov S.I. Radio engineering circuits and signals. M .: Higher. shk., 1988.
  6. Porshnev C.V. Computer simulation of physical processes using the mathcad package.

Source: https://habr.com/ru/post/419911/


All Articles