Chargement des fichiers du répertoire lorenz
[pst-eqdf.git] / lorenz / animXYZ_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 \use@par
130 \psset{#1}%
131 \pnode(!
132 /THETA \psk@TroisD@Theta\space def
133 /PHI \psk@TroisD@Phi\space def
134 /Dobs \psk@TroisD@Dobs\space def
135 /DScreen \psk@TroisD@Ecran\space def
136 /Sin1 THETA sin def
137 /Sin2 PHI sin def
138 /Cos1 THETA cos def
139 /Cos2 PHI cos def
140 /Cos1Sin2 Cos1 Sin2 mul def
141 /Sin1Sin2 Sin1 Sin2 mul def
142 /Cos1Cos2 Cos1 Cos2 mul def
143 /Sin1Cos2 Sin1 Cos2 mul def
144 /xObservateur #2 Sin1 mul neg #3 Cos1 mul add def
145 /yObservateur #2 Cos1Sin2 mul neg #3 Sin1Sin2 mul sub #4 Cos2 mul add def
146 /zObservateur #2 neg Cos1Cos2 mul #3 Sin1Cos2 mul sub #4 Sin2 mul sub Dobs add def
147 /xScreen DScreen xObservateur mul zObservateur div def
148 /yScreen DScreen yObservateur mul zObservateur div def
149 xScreen yScreen){#5}}}
150 %
151 \let\pskTroisDTheta \psk@TroisD@Theta
152 \let\pskTroisDPhi \psk@TroisD@Phi
153 \let\pskTroisDDobs \psk@TroisD@Dobs
154 \let\pskTroisDEcran \psk@TroisD@Ecran
155 \makeatother
156
157 \title{L'attracteur de Lorenz avec PSTricks}
158 \date{12 juin 2012}
159 \begin{document}
160 \def\parametres{
161 /Pr 10 def
162 /Rh 28 def
163 /beta 8 3 div def
164 }%
165 % y[0] y[1] y[2]
166 % x y z
167 \def\Lorenz{
168 Pr*(y[1]-y[0])|%
169 Rh*y[0]-y[1]-y[0]*y[2]|%
170 y[0]*y[1]-beta*y[2]%
171 }
172 \def\conditionsInitiales{10 10 30}
173 \begin{center}
174 \def\nFrames{51}% 200 images
175 \pstVerb{/XY [(LorenzXY.dat) run ] def
176 /XZ [(LorenzXZ.dat) run ] def
177 /YZ [(LorenzYZ.dat) run ] def
178 /tabXYZ [
179 0 2 XY length 2 sub {/i exch def
180 [ XY i get
181 XY i 1 add get
182 YZ i 1 add get
183 ]
184 } for
185 ]def}%
186 \def\nFrames{72}% 72 images
187 \begin{animateinline}[controls,loop,%
188 begin={\begin{pspicture}(-8,-3)(8,12)},
189 end={\end{pspicture}}]{5}% 5 images/s
190 \multiframe{\nFrames}{i=0+5}{% tous les 10 degres
191 \psframe*(-8,-4)(8,14)
192 \psset{THETA=\i,PHI=20,Dobs=2000,Decran=400}
193 \pstVerb{
194 /THETA \pskTroisDTheta def
195 /PHI \pskTroisDPhi def
196 /Dobs \pskTroisDDobs def
197 /DScreen \pskTroisDEcran def
198 }%
199 \pstVerb{
200 /Sin1 THETA sin def
201 /Sin2 PHI sin def
202 /Cos1 THETA cos def
203 /Cos2 PHI cos def
204 /Cos1Sin2 Cos1 Sin2 mul def
205 /Sin1Sin2 Sin1 Sin2 mul def
206 /Cos1Cos2 Cos1 Cos2 mul def
207 /Sin1Cos2 Sin1 Cos2 mul def
208 /IIID {
209 0 1 tabXYZ length 1 sub {/i exch def
210 /TAB tabXYZ i get def
211 /abscisse TAB 0 get def
212 /ordonnee TAB 1 get def
213 /cote TAB 2 get def
214 \formules} for
215 } def
216 }%
217 {\psset{unit=2.5,linestyle=dashed,linecolor=white}
218 \pnodeTroisD(0,0,0){O}
219 \pnodeTroisD(0,0,5){Z}
220 \pnodeTroisD(5,0,0){X}
221 \pnodeTroisD(0,5,0){Y}
222 \pnodeTroisD(-10,-10,0){A}
223 \pnodeTroisD(-10,-10,20){B}
224 \pnodeTroisD(-10,10,20){C}
225 \pnodeTroisD(-10,10,0){D}
226 \pnodeTroisD(10,-10,0){E}
227 \pnodeTroisD(10,-10,20){F}
228 \pnodeTroisD(10,10,20){G}
229 \pnodeTroisD(10,10,0){H}
230 \pspolygon(A)(B)(C)(D)
231 \pspolygon(E)(F)(G)(H)
232 \psline(A)(E)
233 \psline(B)(F)
234 \psline(D)(H)
235 \psline(C)(G)
236 \psset{linestyle=solid,linecolor=red}
237 \psline{->}(O)(X)
238 \psline{->}(O)(Y)
239 \psline{->}(O)(Z)}
240 \listplotHSB[unit=1,linewidth=0.05]{IIID}
241 }
242 \end{animateinline}
243 \end{center}
244 \end{document}
245

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.