Chargement des fichiers du répertoire lorenz
[pst-eqdf.git] / lorenz / animXY_Lorenz-PSTricks.tex
1 \documentclass{article}
2 \usepackage[a4paper,margin=2cm]{geometry}
3 \usepackage{animate}
4 \usepackage{pst-node,pst-eqdf}
5
6 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7 % Essai de Manuel Luque 19 février 2003
8 % transformé par Denis Girou le 25 février 2003
9 % révision le 14 septembre 2011
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11 \makeatletter
12 \pst@addfams{pst-plothsb}
13
14 \define@key[psset]{pst-plothsb}{HueBegin}{% Between 0 and 1
15 \edef\PstParametricplotHSB@HueBegin{#1}}
16
17 \define@key[psset]{pst-plothsb}{HueEnd}{% Between 0 and 1
18 \edef\PstParametricplotHSB@HueEnd{#1}}
19
20 \newif\ifPst@HSB
21 \define@key[psset]{pst-plothsb}{HSB}[true]{\@nameuse{Pst@HSB#1}}
22
23 % Default values
24 \psset{HueBegin=0,HueEnd=1,HSB=true}
25
26 \def\parametricplotHSB{\pst@object{parametricplotHSB}}
27 \def\parametricplotHSB@i{\@ifnextchar[{\parametricplotHSB@do}{\parametricplotHSB@do[]}}
28 \def\parametricplotHSB@do[#1]#2#3#4{{%
29 \psset{#1}%
30 \begin@ClosedObj
31 \addto@pscode{%
32 /t #2 def
33 /dt #3 t sub \psk@plotpoints\space div def
34 /t t dt sub def
35 /Counter 0 def
36 \psk@plotpoints {
37 /t t dt add def
38 /Counter Counter 1 add def
39 /F@pstplot \ifPst@algebraic (#4)
40 tx@AlgToPs begin AlgToPs end cvx
41 \else { #4 }
42 \fi
43 def
44 \ifPst@algebraic
45 F@pstplot
46 \else #4
47 \fi
48 \pst@number\psyunit mul exch
49 \pst@number\psxunit mul exch
50 1 Counter eq
51 {moveto} % First point
52 {\ifPst@HSB % Other points than the first one
53 /PointY exch def
54 /PointX exch def
55 Counter \psk@plotpoints\space div
56 \PstParametricplotHSB@HueEnd\space
57 \PstParametricplotHSB@HueBegin\space sub mul
58 \PstParametricplotHSB@HueBegin\space add
59 1 1 sethsbcolor
60 PointX PointY lineto
61 stroke
62 PointX PointY moveto
63 \else
64 lineto
65 \fi} ifelse
66 } repeat}% fin du code ps
67 \end@ClosedObj}} % fin de la commande PSTricks
68
69 \makeatother
70
71 \makeatletter
72 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73 % adaptation de \parametricplotHSB
74 % à \lisplotHSB
75 % le 10 juin 2012
76 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
77 \def\listplotHSB{\pst@object{listplotHSB}}
78 \def\listplotHSB@i#1{%
79 \begin@ClosedObj
80 \addto@pscode{%
81 /Counter 0 def
82 /XY@ [ #1 ] def
83 XY@ 0 get
84 XY@ 1 get
85 \pst@number\psyunit mul exch
86 \pst@number\psxunit mul exch
87 moveto
88 /L XY@ length def
89 2 2 L 2 sub {/i exch def
90 /x1 XY@ i get \pst@number\psxunit mul def
91 /y1 XY@ i 1 add get \pst@number\psyunit mul def
92 x1 y1
93 \ifPst@HSB
94 Counter L 2 div div
95 \PstParametricplotHSB@HueEnd\space
96 \PstParametricplotHSB@HueBegin\space sub mul
97 \PstParametricplotHSB@HueBegin\space add
98 1 1 sethsbcolor
99 /Counter Counter 1 add def
100 \fi
101 lineto
102 stroke
103 x1 y1 moveto
104 } for
105 }%
106 \end@ClosedObj}
107 \makeatother
108 \def\formules{%
109 /xObservateur abscisse Sin1 mul neg ordonnee Cos1 mul add def
110 /yObservateur abscisse Cos1Sin2 mul neg ordonnee Sin1Sin2 mul sub cote Cos2 mul add def
111 /zObservateur abscisse neg Cos1Cos2 mul ordonnee Sin1Cos2 mul sub cote Sin2 mul sub Dobs add def
112 /xScreen DScreen xObservateur mul zObservateur div def
113 /yScreen DScreen yObservateur mul zObservateur div def
114 xScreen yScreen}
115
116 \makeatletter
117 \pst@addfams{pst-pnodeTroisD}
118
119 \define@key[psset]{pst-pnodeTroisD}{THETA}{\edef\psk@TroisD@Theta{#1 }}
120 \define@key[psset]{pst-pnodeTroisD}{PHI}{\edef\psk@TroisD@Phi{#1 }}
121 \define@key[psset]{pst-pnodeTroisD}{Dobs}{\edef\psk@TroisD@Dobs{#1 }}
122 \define@key[psset]{pst-pnodeTroisD}{Decran}{\edef\psk@TroisD@Ecran{#1 }}
123 \psset{THETA=300,PHI=20,Dobs=200,Decran=25}
124 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
125 \def\pnodeTroisD{\@ifnextchar[{\pst@pnodeTroisD}{\pst@pnodeTroisD[]}}
126
127 \def\pst@pnodeTroisD[#1](#2,#3,#4)#5{{%
128 \pst@killglue
129 \psset{#1}%
130 \pnode(!
131 /THETA \psk@TroisD@Theta\space def
132 /PHI \psk@TroisD@Phi\space def
133 /Dobs \psk@TroisD@Dobs\space def
134 /DScreen \psk@TroisD@Ecran\space def
135 /Sin1 THETA sin def
136 /Sin2 PHI sin def
137 /Cos1 THETA cos def
138 /Cos2 PHI cos def
139 /Cos1Sin2 Cos1 Sin2 mul def
140 /Sin1Sin2 Sin1 Sin2 mul def
141 /Cos1Cos2 Cos1 Cos2 mul def
142 /Sin1Cos2 Sin1 Cos2 mul def
143 /xObservateur #2 Sin1 mul neg #3 Cos1 mul add def
144 /yObservateur #2 Cos1Sin2 mul neg #3 Sin1Sin2 mul sub #4 Cos2 mul add def
145 /zObservateur #2 neg Cos1Cos2 mul #3 Sin1Cos2 mul sub #4 Sin2 mul sub Dobs add def
146 /xScreen DScreen xObservateur mul zObservateur div def
147 /yScreen DScreen yObservateur mul zObservateur div def
148 xScreen yScreen){#5}}}
149 \makeatother
150 %timeline
151 \begin{filecontents}{lorenzxy.txt}
152 ::0x0
153 ::1
154 ::2
155 ::3
156 ::4
157 ::5
158 ::6
159 ::7
160 ::8
161 ::9
162 ::10
163 ::11
164 ::12
165 ::13
166 ::14
167 ::15
168 ::16
169 ::17
170 ::18
171 ::19
172 ::20
173 ::21
174 ::22
175 ::23
176 ::24
177 ::25
178 ::26
179 ::27
180 ::28
181 ::29
182 ::30
183 ::31
184 ::32
185 ::33
186 ::34
187 ::35
188 ::36
189 ::37
190 ::38
191 ::39
192 ::40
193 ::41
194 ::42
195 ::43
196 ::44
197 ::45
198 ::46
199 ::47
200 ::48
201 ::49
202 ::50
203 ::51
204 \end{filecontents}
205 \title{L'attracteur de Lorenz avec PSTricks}
206 \date{12 juin 2012}
207 \begin{document}
208 \def\parametres{
209 /Pr 10 def
210 /Rh 28 def
211 /beta 8 3 div def
212 }%
213 % y[0] y[1] y[2]
214 % x y z
215 \def\Lorenz{
216 Pr*(y[1]-y[0])|%
217 Rh*y[0]-y[1]-y[0]*y[2]|%
218 y[0]*y[1]-beta*y[2]%
219 }
220 \def\conditionsInitiales{10 10 30}
221 \begin{center}
222 \begin{pspicture}(-8,-.01)(8,0.01)
223 %\psgrid[subgriddiv=0,gridcolor=lightgray,griddots=10,gridlabels=0pt]%
224 \pstVerb{\parametres}%
225 \psequadiff[% x,y
226 tabname=tabXY,
227 method=rk4,
228 whichabs=0,whichord=1,
229 saveData,filename=LorenzXY.dat,
230 plotpoints=2501,algebraic]{0}{25}{\conditionsInitiales}{\Lorenz}
231 %% une commande PSTricks est indispensable si on ne vaut pas tracer le courbe
232 \psdot[linecolor=white,dotsize=0.001](0,0)
233 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
234 %\listplotHSB[unit=0.25]{tabXY aload pop}%
235 %\uput[r](8,0){$x$}
236 %\uput[u](0,8){$y$}
237 \end{pspicture}
238 \end{center}
239 \begin{center}
240 \def\nFrames{51}% 200 images
241 \pstVerb{/XYlorentz [ (LorenzXY.dat) run ] def}%
242 \begin{animateinline}[controls,timeline=lorenzxy.txt,%
243 begin={\begin{pspicture}(-8,-6)(8,7)},
244 end={\end{pspicture}}]{10}% 10 images/s
245 \psgrid[subgriddiv=0,gridcolor=lightgray,griddots=10,gridlabels=0pt]%
246 \rput(0,6.5){\large\textbf{XY}$(x_0=10,y_0=10,z_0=30)$}
247 \listplotHSB[unit=0.25,HSB=false,linecolor=gray]{XYlorentz aload pop}%
248 \newframe
249 \multiframe{\nFrames}{i=0+100}{% 1 point sur 10
250 \pstVerb{ /XYpartiel {0 2 \i\space {/i exch def
251 XYlorentz i get
252 XYlorentz i 1 add get
253 } for
254 }def
255 }%
256 \listplotHSB[unit=0.25,linewidth=0.2]{XYpartiel}%
257 }
258 \end{animateinline}
259 \end{center}
260 \end{document}
261

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.