X-Git-Url: https://melusine.eu.org/syracuse/G/git/?a=blobdiff_plain;f=lorenz%2FanimXZ_Lorenz-PSTricks.tex;fp=lorenz%2FanimXZ_Lorenz-PSTricks.tex;h=dd5aba2e684324d62fe69cdf7009336b9ef7b7c6;hb=fda32923f8b15421e227324231c7f46c220da950;hp=0000000000000000000000000000000000000000;hpb=eaa4e47d6338f5e5e679c1b5ef9bdc3501c3110e;p=pst-eqdf.git diff --git a/lorenz/animXZ_Lorenz-PSTricks.tex b/lorenz/animXZ_Lorenz-PSTricks.tex new file mode 100644 index 0000000..dd5aba2 --- /dev/null +++ b/lorenz/animXZ_Lorenz-PSTricks.tex @@ -0,0 +1,261 @@ +\documentclass{article} +\usepackage[a4paper,margin=2cm]{geometry} +\usepackage{animate} +\usepackage{pst-node,pst-eqdf} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Essai de Manuel Luque 19 février 2003 +% transformé par Denis Girou le 25 février 2003 +% révision le 14 septembre 2011 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\makeatletter +\pst@addfams{pst-plothsb} + +\define@key[psset]{pst-plothsb}{HueBegin}{% Between 0 and 1 +\edef\PstParametricplotHSB@HueBegin{#1}} + +\define@key[psset]{pst-plothsb}{HueEnd}{% Between 0 and 1 +\edef\PstParametricplotHSB@HueEnd{#1}} + +\newif\ifPst@HSB +\define@key[psset]{pst-plothsb}{HSB}[true]{\@nameuse{Pst@HSB#1}} + +% Default values +\psset{HueBegin=0,HueEnd=1,HSB=true} + +\def\parametricplotHSB{\pst@object{parametricplotHSB}} +\def\parametricplotHSB@i{\@ifnextchar[{\parametricplotHSB@do}{\parametricplotHSB@do[]}} +\def\parametricplotHSB@do[#1]#2#3#4{{% +\psset{#1}% +\begin@ClosedObj +\addto@pscode{% +/t #2 def +/dt #3 t sub \psk@plotpoints\space div def +/t t dt sub def +/Counter 0 def +\psk@plotpoints { + /t t dt add def + /Counter Counter 1 add def +/F@pstplot \ifPst@algebraic (#4) + tx@AlgToPs begin AlgToPs end cvx + \else { #4 } + \fi + def +\ifPst@algebraic + F@pstplot + \else #4 +\fi + \pst@number\psyunit mul exch + \pst@number\psxunit mul exch + 1 Counter eq + {moveto} % First point + {\ifPst@HSB % Other points than the first one + /PointY exch def + /PointX exch def + Counter \psk@plotpoints\space div + \PstParametricplotHSB@HueEnd\space + \PstParametricplotHSB@HueBegin\space sub mul + \PstParametricplotHSB@HueBegin\space add + 1 1 sethsbcolor + PointX PointY lineto + stroke + PointX PointY moveto + \else + lineto + \fi} ifelse + } repeat}% fin du code ps +\end@ClosedObj}} % fin de la commande PSTricks + +\makeatother + +\makeatletter +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% adaptation de \parametricplotHSB +% à \lisplotHSB +% le 10 juin 2012 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\listplotHSB{\pst@object{listplotHSB}} +\def\listplotHSB@i#1{% +\begin@ClosedObj + \addto@pscode{% + /Counter 0 def + /XY@ [ #1 ] def + XY@ 0 get + XY@ 1 get + \pst@number\psyunit mul exch + \pst@number\psxunit mul exch + moveto + /L XY@ length def + 2 2 L 2 sub {/i exch def + /x1 XY@ i get \pst@number\psxunit mul def + /y1 XY@ i 1 add get \pst@number\psyunit mul def + x1 y1 + \ifPst@HSB + Counter L 2 div div + \PstParametricplotHSB@HueEnd\space + \PstParametricplotHSB@HueBegin\space sub mul + \PstParametricplotHSB@HueBegin\space add + 1 1 sethsbcolor + /Counter Counter 1 add def + \fi + lineto + stroke + x1 y1 moveto + } for + }% +\end@ClosedObj} +\makeatother +\def\formules{% + /xObservateur abscisse Sin1 mul neg ordonnee Cos1 mul add def + /yObservateur abscisse Cos1Sin2 mul neg ordonnee Sin1Sin2 mul sub cote Cos2 mul add def + /zObservateur abscisse neg Cos1Cos2 mul ordonnee Sin1Cos2 mul sub cote Sin2 mul sub Dobs add def + /xScreen DScreen xObservateur mul zObservateur div def + /yScreen DScreen yObservateur mul zObservateur div def + xScreen yScreen} + +\makeatletter +\pst@addfams{pst-pnodeTroisD} + +\define@key[psset]{pst-pnodeTroisD}{THETA}{\edef\psk@TroisD@Theta{#1 }} +\define@key[psset]{pst-pnodeTroisD}{PHI}{\edef\psk@TroisD@Phi{#1 }} +\define@key[psset]{pst-pnodeTroisD}{Dobs}{\edef\psk@TroisD@Dobs{#1 }} +\define@key[psset]{pst-pnodeTroisD}{Decran}{\edef\psk@TroisD@Ecran{#1 }} +\psset{THETA=300,PHI=20,Dobs=200,Decran=25} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\pnodeTroisD{\@ifnextchar[{\pst@pnodeTroisD}{\pst@pnodeTroisD[]}} + +\def\pst@pnodeTroisD[#1](#2,#3,#4)#5{{% +\pst@killglue +\psset{#1}% +\pnode(! + /THETA \psk@TroisD@Theta\space def + /PHI \psk@TroisD@Phi\space def + /Dobs \psk@TroisD@Dobs\space def + /DScreen \psk@TroisD@Ecran\space def + /Sin1 THETA sin def + /Sin2 PHI sin def + /Cos1 THETA cos def + /Cos2 PHI cos def + /Cos1Sin2 Cos1 Sin2 mul def + /Sin1Sin2 Sin1 Sin2 mul def + /Cos1Cos2 Cos1 Cos2 mul def + /Sin1Cos2 Sin1 Cos2 mul def + /xObservateur #2 Sin1 mul neg #3 Cos1 mul add def + /yObservateur #2 Cos1Sin2 mul neg #3 Sin1Sin2 mul sub #4 Cos2 mul add def + /zObservateur #2 neg Cos1Cos2 mul #3 Sin1Cos2 mul sub #4 Sin2 mul sub Dobs add def + /xScreen DScreen xObservateur mul zObservateur div def + /yScreen DScreen yObservateur mul zObservateur div def + xScreen yScreen){#5}}} +\makeatother +%timeline +\begin{filecontents}{lorenzXZ.txt} +::0x0 +::1 +::2 +::3 +::4 +::5 +::6 +::7 +::8 +::9 +::10 +::11 +::12 +::13 +::14 +::15 +::16 +::17 +::18 +::19 +::20 +::21 +::22 +::23 +::24 +::25 +::26 +::27 +::28 +::29 +::30 +::31 +::32 +::33 +::34 +::35 +::36 +::37 +::38 +::39 +::40 +::41 +::42 +::43 +::44 +::45 +::46 +::47 +::48 +::49 +::50 +::51 +\end{filecontents} +\title{L'attracteur de Lorenz avec PSTricks} +\date{12 juin 2012} +\begin{document} +\def\parametres{ + /Pr 10 def + /Rh 28 def + /beta 8 3 div def +}% +% y[0] y[1] y[2] + % x y z +\def\Lorenz{ +Pr*(y[1]-y[0])|% +Rh*y[0]-y[1]-y[0]*y[2]|% +y[0]*y[1]-beta*y[2]% +} +\def\conditionsInitiales{10 10 30} +\begin{center} +\begin{pspicture}(-8,-.01)(8,0.01) +%\psgrid[subgriddiv=0,gridcolor=lightgray,griddots=10,gridlabels=0pt]% +\pstVerb{\parametres}% + \psequadiff[% x,y + tabname=tabXZ, + method=rk4, + whichabs=0,whichord=2, + saveData,filename=LorenzXZ.dat, + plotpoints=2501,algebraic]{0}{25}{\conditionsInitiales}{\Lorenz} +%% une commande PSTricks est indispensable si on ne vaut pas tracer le courbe + \psdot[linecolor=white,dotsize=0.001](0,0) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\listplotHSB[unit=0.25]{tabXY aload pop}% +%\uput[r](8,0){$x$} +%\uput[u](0,8){$y$} +\end{pspicture} +\end{center} +\begin{center} +\def\nFrames{51}% 200 images +\pstVerb{/XZlorenz [ (LorenzXZ.dat) run ] def}% +\begin{animateinline}[controls,timeline=lorenzxy.txt,% + begin={\begin{pspicture}(-8,-1)(8,14)}, + end={\end{pspicture}}]{10}% 10 images/s +\psgrid[subgriddiv=0,gridcolor=lightgray,griddots=10,gridlabels=0pt]% +\rput(0,13.5){\large\textbf{XZ}$(x_0=10,y_0=10,z_0=30)$} +\listplotHSB[unit=0.25,HSB=false,linecolor=gray]{XZlorenz aload pop}% +\newframe +\multiframe{\nFrames}{i=0+100}{% tous les 100 pts + \pstVerb{ /XZpartiel {0 2 \i\space {/i exch def + XZlorenz i get + XZlorenz i 1 add get + } for + }def + }% +\listplotHSB[unit=0.25,linewidth=0.2,HueBegin=.25,HueEnd=0.65]{XZpartiel}% +} +\end{animateinline} +\end{center} +\end{document} +