Академический Документы
Профессиональный Документы
Культура Документы
Here is the traditional simulation of two stars attracting each other according to the classical grav-
1
itation law in . In 2-Dimensions, the system to be solved is composed of four second order dif-
r2
ferential equations. In order to be described, each of them gives two first order equations, then we
obtain a 8 sized vectorial equation. In the following example the masses of the stars are 1 and 20.
M2
x′′1 = 2 cos(θ) 2 M2
r r = (x1 − x2 )2 + (y1 − y2 )2 b
y1′′ = M2 sin(θ)
(x1 − x2 ) r F2
r2 avec cos(θ) =
′′ M1 r θ
x2 = 2 cos(θ) sin(θ) = (y1 − y2 )
F1
r
y ′′ = M1 sin(θ) r
b
2
r2 M1
y[2]| %% y’[0]
y[3]| %% y’[1]
(y[4]-y[0])/((y[4]-y[0])^2+(y[5]-y[1])^2)^1.5| %% y’[2]=y”[0]
(y[5]-y[1])/((y[4]-y[0])^2+(y[5]-y[1])^2)^1.5| %% y’[3]=y”[1]
y[6]| %% y’[4]
y[7]| %% y’[5]
20*(y[0]-y[4])/((y[4]-y[0])^2+(y[5]-y[1])^2)^1.5| %% y’[6]=y”[4]
20*(y[1]-y[5])/((y[4]-y[0])^2+(y[5]-y[1])^2)^1.5 %% y’[7]=y”[5]
2
b b b b b
b
b b
b
\def\InitCond{ 1 1 .1 0 -1 -1 -2 0}
b b
1 b
b \begin{pspicture}[shift=-2,showgrid=true](-3,-1.75)(2,1.5)
b b
b
b
b \psplotDiffEqn[whichabs=0, whichord=1, linecolor=blue, method=rk4,
b
b
0 b b
b plotpoints=100]{0}{3.95}{\InitCond}{\Grav}
b
b
b \psset{showpoints=true,whichabs=4, whichord=5}
b
b b
b
b \psplotDiffEqn[linecolor=black, method=varrkiv, varsteptol=.0001,
-1 b
b b bb b b
plotpoints=200]{0}{3.9}{\InitCond}{\Grav}
\end{pspicture}
-2
-3 -2 -1 0 1 2
Figure 4: Gravitational interaction: fixed landmark, trajectory of the stars