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)=dotvecrβ²(t)+dotvecR(t) , (2) Where dotvecrβ²(t) - point speed relative to the system Kβ² ; dotvecR(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,496cdot108 km (period of circulation T1=3.156cdot107 with.). The moon, in turn, moves around the Earth (system K ') around a circle of radius R2=3,844cdot105 km (circulation period T2=2.36cdot106 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:
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:
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,496cdot108km,T1=3,156cdot107s . The moon moves around the earth in the coordinate system ( Kβ² ) its orbit radius and orbital period are respectively equal R2=3.844cdot105km,T2=2.36cdot106s .
Taking into account (4), we define the functions of dependence of coordinates on time:
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,844cdot107 . .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:
We write the program taking into account (5), (8), (9) and the radius of the orbit of the moon R2=3,844cdot105 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,844cdot105 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,844cdot107 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,496cdot108 km, period of circulation T1=$365.2 day, Mars moves along an ellipse, the semi-major axis of which am=2.28cdot108 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]:
A complete ellipse turn corresponds to a change in the parameter <img varepsilon from 0 to 2pi . 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)=R1cdotcos(frac2piT1t) , (13)
Y(t)=R1cdotsin(frac2piT1t) ,(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:
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:
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) :
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:
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:
distance of the comet from the Sun at perihelion (the point of the orbit closest to the Sun) and aphelion (the point of the orbit farthest from the Sun);
the speed of the comet during its passage through perihelion and through aphelion;
the period of circulation of the comet around the sun;
The following two dates of passage of the comet through perihelion.
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:
Feynman R., Leighton R., Sands M. The Feynman Lectures on Physics. 3rd ed. T. 1.-2. M .: Mir, 1977.
Matveev A. N. Mechanics and Theory of Relativity. M .: Higher. shk., 1986.
Physical Encyclopedia. T. 3. M .: Great Russian Encyclopedia, 1992.
Landau L. D., Lifshits E. M. The course of theoretical physics. Mechanics. M .: Fyut-Matgiz, 1958.
Baskakov S.I. Radio engineering circuits and signals. M .: Higher. shk., 1988.
Porshnev C.V. Computer simulation of physical processes using the mathcad package.