X-Git-Url: https://melusine.eu.org/syracuse/G/git/?a=blobdiff_plain;f=lorenz%2FanimXYZ_Lorenz-PSTricks.tex;fp=lorenz%2FanimXYZ_Lorenz-PSTricks.tex;h=711bcdef8b1a1f7d2c3d5c27cc27d6a5c47d9544;hb=fda32923f8b15421e227324231c7f46c220da950;hp=0000000000000000000000000000000000000000;hpb=eaa4e47d6338f5e5e679c1b5ef9bdc3501c3110e;p=pst-eqdf.git diff --git a/lorenz/animXYZ_Lorenz-PSTricks.tex b/lorenz/animXYZ_Lorenz-PSTricks.tex new file mode 100644 index 0000000..711bcde --- /dev/null +++ b/lorenz/animXYZ_Lorenz-PSTricks.tex @@ -0,0 +1,245 @@ +\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 +\use@par +\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}}} + % + \let\pskTroisDTheta \psk@TroisD@Theta + \let\pskTroisDPhi \psk@TroisD@Phi + \let\pskTroisDDobs \psk@TroisD@Dobs + \let\pskTroisDEcran \psk@TroisD@Ecran +\makeatother + +\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} +\def\nFrames{51}% 200 images +\pstVerb{/XY [(LorenzXY.dat) run ] def + /XZ [(LorenzXZ.dat) run ] def + /YZ [(LorenzYZ.dat) run ] def +/tabXYZ [ + 0 2 XY length 2 sub {/i exch def + [ XY i get + XY i 1 add get + YZ i 1 add get + ] + } for + ]def}% +\def\nFrames{72}% 72 images +\begin{animateinline}[controls,loop,% + begin={\begin{pspicture}(-8,-3)(8,12)}, + end={\end{pspicture}}]{5}% 5 images/s +\multiframe{\nFrames}{i=0+5}{% tous les 10 degres +\psframe*(-8,-4)(8,14) +\psset{THETA=\i,PHI=20,Dobs=2000,Decran=400} +\pstVerb{ + /THETA \pskTroisDTheta def + /PHI \pskTroisDPhi def + /Dobs \pskTroisDDobs def + /DScreen \pskTroisDEcran def + }% +\pstVerb{ + /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 + /IIID { + 0 1 tabXYZ length 1 sub {/i exch def + /TAB tabXYZ i get def + /abscisse TAB 0 get def + /ordonnee TAB 1 get def + /cote TAB 2 get def + \formules} for + } def + }% +{\psset{unit=2.5,linestyle=dashed,linecolor=white} +\pnodeTroisD(0,0,0){O} +\pnodeTroisD(0,0,5){Z} +\pnodeTroisD(5,0,0){X} +\pnodeTroisD(0,5,0){Y} +\pnodeTroisD(-10,-10,0){A} +\pnodeTroisD(-10,-10,20){B} +\pnodeTroisD(-10,10,20){C} +\pnodeTroisD(-10,10,0){D} +\pnodeTroisD(10,-10,0){E} +\pnodeTroisD(10,-10,20){F} +\pnodeTroisD(10,10,20){G} +\pnodeTroisD(10,10,0){H} +\pspolygon(A)(B)(C)(D) +\pspolygon(E)(F)(G)(H) +\psline(A)(E) +\psline(B)(F) +\psline(D)(H) +\psline(C)(G) +\psset{linestyle=solid,linecolor=red} +\psline{->}(O)(X) +\psline{->}(O)(Y) +\psline{->}(O)(Z)} +\listplotHSB[unit=1,linewidth=0.05]{IIID} +} +\end{animateinline} +\end{center} +\end{document} +