Le problème des 3 corps : partie 1 : l'un des corps est très massif par rapport aux...
[pst-eqdf.git] / gravitation / pst-eqdf.tex
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -*- Mode: Latex -*- %%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %% pst-eqdf.tex --- plotting of differential equations
3 %% Copyright 2004 Dominique RODRIGUEZ
4 %%
5 %% Author : Dominique RODRIGUEZ (EN) <dominique.rodriguez@waika9.com>
6 %% Created the : ven avr 2 22:02:01 CEST 2004
7 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8 %% HISTORY
9 %%
10 %% 2004-04-04 : creation of the file from a first LaTeX protype sty file
11 %%
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13 \def\fileversion{pre-1.0}
14 \def\filedate{2004/03/21}%
15 %% This program can be redistributed and/or modified under the terms
16 %% of the LaTeX Project Public License Distributed from CTAN
17 %% archives in directory macros/latex/base/lppl.txt.
18 %% adapation de M.Luque juin 2012 pour
19 %% sauvegarde de tableaux de valeurs
20 \message{`PST-Equadiff v\fileversion, \filedate\space (Dominique RODRIGUEZ)}%
21 \csname PSTEquadiffLoaded\endcsname
22 \let\PSTEquadiffLoaded\endinput
23 % Require PSTricks and pst-node packages
24 \ifx\PSTricksLoaded\endinput\else \input pstricks \fi
25 \ifx\PSTplotLoaded\endinput\else \input pst-plot.tex\fi
26 \ifx\PSTXKeyLoaded\endinput\else \input pst-xkey.tex \fi
27 \edef\PstAtCode{\the\catcode`\@}%
28 \catcode`\@=11\relax
29 % Definition of the parameters
30 % ----------------------------
31 % Added by JG, 2012 06 20
32 \def\datRoot{}
33 % Definition of a "Root" within the hard drive for Distiller users
34 % Note: The root must be set with "slashes" not "backslashes" like
35 % \def\datRoot{C:/Users/Desktop/datfolder/}
36 % By default the \datRoot is left empty (for non-Distiller usage)
37 \pst@addfams{pst-eqd}
38 \define@key[psset]{pst-eqd}{method}{\edef\psk@method{#1}}%
39 \define@key[psset]{pst-eqd}{whichabs}{\edef\psk@whichabs{#1}}%
40 \define@key[psset]{pst-eqd}{whichord}{\edef\psk@whichord{#1}}%
41 \define@key[psset]{pst-eqd}{plotfuncx}{\edef\psk@plotfuncx{#1}}%
42 \define@key[psset]{pst-eqd}{plotfuncy}{\edef\psk@plotfuncy{#1}}%
43 \define@key[psset]{pst-eqd}{tabname}{\edef\psk@tabname{#1}}%
44 \define@key[psset]{pst-eqd}{filename}{\edef\psk@filename{\datRoot#1}}%
45 \newif\ifPst@buildvector%
46 \define@key[psset]{pst-eqd}{buildvector}[true]{\@nameuse{Pst@buildvector#1}}%
47 \newif\ifPst@saveData%
48 \define@key[psset]{pst-eqd}{saveData}[true]{\@nameuse{Pst@saveData#1}}%
49 \psset[pst-eqd]{method=default, whichabs={}, whichord={}, filename=datas.dat,
50 plotfuncx={}, plotfuncy={}, buildvector=false, tabname=tabValues, saveData=false}
51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52 \SpecialCoor%% for using polar coordinates, node position, ...
53 \psset{dimen=middle}%
54 \def\@undef{undef}%
55 \def\@default{default}%
56 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 %% #1-#2 x range
58 %% #3 initial value of y (which is a vector)
59 %% #4 value of the d\'{e}rivative (y and t can be used)
60 \def\psequadiff{\def\pst@par{}\pst@object{psequadiff}}
61 \def\psequadiff@i#1#2#3#4{%
62 \pst@killglue
63 \begingroup
64 \use@par
65 %\pstVerb{
66 \addto@pscode{
67 /x #1 def
68 /x1 #2 def
69 /y [ #3 ] def
70 /ylength y length def
71 /addvect
72 { /len exch def 1 1 len
73 { /i exch def len i sub 2 add -1 roll add len 2 mul i sub 1 roll } for } def
74 /dx x1 x sub \psk@plotpoints div def
75 /mulvect { exch 1 index { dup 4 -1 roll mul 2 index 2 add 1 roll } repeat pop pop } def
76 /divvect { exch 1 index { dup 4 -1 roll exch div 2 index 2 add 1 roll } repeat pop pop } def
77 /k0 0 def /k1 0 def /k2 0 def /k3 0 def
78 \ifPst@algebraic /F@pstplot (#4) AlgParser cvx def \fi
79 /Func {
80 \ifPst@algebraic F@pstplot ylength array astore
81 \else
82 \ifPst@buildvector\else y aload pop \fi #4
83 \ifPst@buildvector\else ylength array astore \fi
84 \fi
85 } def
86 /xy {
87 \ifx\psk@method\@default%
88 \ifx\psk@plotfuncx\@empty
89 \ifx\psk@whichabs\@empty x \else y \psk@whichabs\space get \fi%
90 \else\psk@plotfuncx\space\fi%
91 % \pst@number\psxunit mul
92 y /y Func { dx mul } forall y aload pop ylength addvect ylength array astore def
93 \ifx\psk@plotfuncy\@empty
94 \ifx\psk@whichord\@empty 0 \else\psk@whichord\space\fi get %
95 \else\psk@plotfuncy\space\fi
96 \else%
97 \ifx\psk@plotfuncx\@empty
98 \ifx\psk@whichabs\@empty x \else y \psk@whichabs\space get \fi%
99 \else\psk@plotfuncx\space\space\fi%
100 y /k0 Func { dx mul } forall ylength array astore def %% y
101 dup aload pop k0 { 2 div } forall ylength addvect ylength array astore /y exch def %
102 x dup dx 2 div add /x exch def %% y x
103 /k1 Func { dx mul } forall ylength array astore def %% y x
104 exch dup aload pop k1 { 2 div } forall ylength addvect y astore pop %% x y
105 /k2 Func { dx mul } forall ylength array astore def %% x y
106 dup aload pop k2 aload pop ylength addvect y astore pop exch dup dx add /x exch def %% y x
107 /k3 Func { dx mul } forall ylength array astore def %% y x
108 /x exch def %% y
109 dup aload pop k0 aload pop k1 aload pop k2 aload pop ylength addvect
110 2 ylength mulvect ylength addvect k3 aload pop ylength addvect
111 6 ylength divvect ylength addvect y astore pop
112 \ifx\psk@plotfuncy\@empty
113 \ifx\psk@whichord\@empty 0 \else\psk@whichord\space\fi get %
114 \else\psk@plotfuncy\space\fi
115 \fi
116 } def
117 /\psk@tabname[
118 \psk@plotpoints {
119 xy
120 /x x dx add
121 def
122 } repeat
123 /x x1 def
124 xy
125 ] def
126 \ifPst@saveData
127 /fichierpoints (\psk@filename) (w) file def
128 0 2 \psk@tabname\space length 2 sub {/i exch def
129 /xi \psk@tabname\space i get def
130 /yi \psk@tabname\space i 1 add get def
131 fichierpoints xi 15 string cvs writestring
132 fichierpoints 32 write %% espace
133 fichierpoints yi 15 string cvs writestring
134 fichierpoints 32 write %% espace
135 fichierpoints 10 write %% CR
136 } for
137 fichierpoints closefile
138 \fi
139 }%
140 \endgroup
141 \ignorespaces}
142 %%% Local Variables:
143 %%% mode: latex
144 %%% TeX-master: t
145 %%% End:

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.