Ajouté L'animation du satellite ...
[pst-eqdf.git] / gravitation / animation_satellite.tex
1 \documentclass{article}
2 \usepackage[a4paper,margin=2cm]{geometry}
3 \usepackage[latin1]{inputenc}
4 \usepackage{pstricks,pst-eqdf}
5 \usepackage{animate}
6 \newpsstyle{vecteurA}{arrowinset=0.05,arrowsize=0.125,linecolor={[rgb]{1 0.5 0}}}
7 \newpsstyle{vecteurB}{arrowinset=0.05,arrowsize=0.1,linecolor={[rgb]{0 0.7 1}}}
8 \newpsstyle{vecteurC}{arrowinset=0.1,arrowsize=0.2,linecolor={[rgb]{1 0.5 0}}}
9 %%%%%%%%%%%%%%%%%%
10 \title{Animation du mouvement d'un satellite}
11 \date{23 juin 2\,012}
12 %timeline
13 \begin{filecontents}{satellite.dat}
14 ::0x0
15 ::1
16 ::2
17 ::3
18 ::4
19 ::5
20 ::6
21 ::7
22 ::8
23 ::9
24 ::10
25 ::11
26 ::12
27 ::13
28 ::14
29 ::15
30 ::16
31 ::17
32 ::18
33 ::19
34 ::20
35 ::21
36 ::22
37 ::23
38 ::24
39 ::25
40 ::26
41 ::27
42 ::28
43 ::29
44 ::30
45 ::31
46 ::32
47 ::33
48 ::34
49 ::35
50 ::36
51 ::37
52 ::38
53 ::39
54 ::40
55 ::41
56 ::42
57 ::43
58 ::44
59 ::45
60 ::46
61 ::47
62 ::48
63 ::49
64 ::50
65 ::51
66 ::52
67 \end{filecontents}
68 \newcommand{\Jupiter}{%
69 \psclip{\pscircle[fillstyle=solid,fillcolor=yellow]{1.5}}
70 \psset{fillstyle=solid,fillcolor={[cmyk]{0 0.2 0.4 0}},linestyle=none}
71 \psframe(-2,.6)(2,1)
72 \psframe(-2,0.45)(2,0.52)
73 \psframe(-2,.05)(2,.3)
74 \psframe(-2,-0.35)(2,-0.2)
75 \psframe(-2,-0.9)(2,-.5)
76 \endpsclip
77 \psellipse[fillstyle=solid,fillcolor={[cmyk]{0 0.4 0.6 0}},linestyle=none](-0.3,-0.6)(0.35,0.2)
78 \pscircle{1.5}}
79 \begin{document}
80 \def\eqsatellite{%
81 y[2]|y[3]|-GM*y[0]/((sqrt(y[0]^2+y[1]^2))^3)|-GM*y[1]/((sqrt(y[0]^2+y[1]^2))^3)}%
82 \begin{center}
83 %\begin{pspicture}(-10,-10)(6,6)
84 \def\nFrames{50}% 50 images
85 \begin{animateinline}[controls,loop,timeline=satellite.dat,%
86 begin={\begin{pspicture}(-10,-10)(6,6)},
87 end={\end{pspicture}}]{5}% 5 images/s
88 %\uput[r](0,3){$y$}\uput[u](3,0){$x$}
89 %\psset{unit=2}
90 \psframe*[linecolor={[rgb]{0 0 0.5}}](-10,-10)(6,6)
91 \pstVerb{/tabXiYi [(XiYi.dat) run] def}%
92 \pstVerb{/GM 1 def
93 /theta0 30 def
94 /r0 2 def
95 /x0 r0 theta0 cos mul def
96 /y0 r0 theta0 sin mul def
97 /v0 0.85 def
98 /v0x v0 theta0 sin mul neg def
99 /v0y v0 theta0 cos mul def
100 /Lc r0 v0 mul def % moment cinetique
101 /par Lc dup mul GM div def % paramètre de l'ellipse
102 % excentricité
103 /exc 1 0.5 v0 4 exp mul r0 dup mul mul GM r0 mul v0 dup mul mul sub GM dup mul div 2 mul add sqrt def
104 %%%%%%%%%%%%%%
105 /a_2 par 1 exc dup mul sub div def % demi-grand axe
106 /b_2 par 1 exc dup mul sub sqrt div def % demi-petit axe
107 /periode 2 3.1416 dup mul a_2 3 exp mul GM div sqrt mul def}%
108 \psequadiff[method=rk4,
109 plotpoints=1000,
110 algebraic,
111 whichabs=0,
112 whichord=1,
113 tabname=XiYi,
114 % saveData,filename=XiYi.dat
115 ]{0}{43}{x0 y0 v0x v0y}{\eqsatellite}%
116 \listplot[linecolor=gray,unit=2]{XiYi aload pop}
117 \psequadiff[method=rk4,
118 plotpoints=1000,
119 algebraic,
120 whichabs=2,
121 whichord=3,
122 tabname=vxvy,
123 % saveData,filename=vxvy.dat
124 ]{0}{43}{x0 y0 v0x v0y}{\eqsatellite}%
125 %\listplot[unit=2,linecolor=red]{vxvy aload pop}
126 % on dessine la vitesse un point sur 50
127 %\pscircle[fillcolor=gray!70,fillstyle=solid,unit=2](0,0){0.4}
128 \Jupiter%
129 %\psgrid[subgriddiv=2,gridcolor=lightgray,gridlabels=8pt,unit=2](-5,-5)(3,3)
130 %\psline[arrowinset=0.05,arrowsize=0.1,unit=2]{<->}(3,0)(0,0)(0,3)
131 \newframe
132 \multiframe{\nFrames}{i=0+40}{
133 \psset{unit=2}%
134 \pstVerb{/tabXYpartiel {
135 2 2 \i\space {/I exch def
136 tabXiYi I get
137 tabXiYi I 1 add get
138 } for
139 } def
140 /vX vxvy \i\space get def
141 /vY vxvy \i\space 1 add get def
142 /xi tabXiYi \i\space get def
143 /yi tabXiYi \i\space 1 add get def
144 /ri3 xi dup mul yi dup mul add sqrt 3 exp def
145 /Fx xi ri3 div neg def
146 /Fy yi ri3 div neg def}%
147 \listplot[linecolor=red,linewidth=0.05]{tabXYpartiel}
148 \rput(!xi yi){\pscircle[fillstyle=solid,fillcolor=gray!50]{0.075}\psline[style=vecteurA]{->}(! vX 2 mul vY 2 mul)\psline[style=vecteurB]{->}(! Fx 5 mul Fy 5 mul)}}
149 \newframe
150 \listplot[linecolor=gray,unit=2]{XiYi aload pop}
151 \listplot[linecolor=red,unit=2,linewidth=0.05]{XiYi aload pop}
152 \psset{unit=2}%
153 \rput(!x0 y0){\pscircle[fillstyle=solid,fillcolor=gray!50]{0.075}\psline[style=vecteurA]{->}(! v0x 2 mul v0y 2 mul)\psline[style=vecteurB]{->}(! x0 r0 3 exp div 5 mul neg y0 r0 3 exp div 5 mul neg)}
154 \end{animateinline}
155 \end{center}
156 \end{document}

Licence Creative Commons Les fichiers de Syracuse sont mis à disposition (sauf mention contraire) selon les termes de la
Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 4.0 International.