1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -*- Mode: Latex -*- %%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %% pst-eqdf.tex --- plotting of differential equations
3 %% Copyright 2004 Dominique RODRIGUEZ
5 %% Author : Dominique RODRIGUEZ (EN) <dominique.rodriguez@waika9.com>
6 %% Created the : ven avr 2 22:02:01 CEST 2004
7 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10 %% 2004-04-04 : creation of the file from a first LaTeX protype sty file
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\PSTplotLoaded\endinput\else\input pst-plot.tex
\fi
25 %% prologue for postcript
26 %%\pstheader{pst-eucl.pro}%
27 % DPC interface to the `keyval' package (until keyval based version of PSTricks)
29 \edef\PstAtCode{\the\catcode`\@
}%
31 % Definition of the parameters
32 % ----------------------------
34 \define@key
[psset
]{pst-eqd
}{method
}{\edef\psk@method
{#1}}%
35 \define@key
[psset
]{pst-eqd
}{whichabs
}{\edef\psk@whichabs
{#1}}%
36 \define@key
[psset
]{pst-eqd
}{whichord
}{\edef\psk@whichord
{#1}}%
37 \define@key
[psset
]{pst-eqd
}{plotfuncx
}{\edef\psk@plotfuncx
{#1}}%
38 \define@key
[psset
]{pst-eqd
}{plotfuncy
}{\edef\psk@plotfuncy
{#1}}%
39 \define@key
[psset
]{pst-eqd
}{tabname
}{\edef\psk@tabname
{#1}}%
40 \define@key
[psset
]{pst-eqd
}{filename
}{\edef\psk@filename
{#1}}%
41 \newif\ifPst@buildvector
%
42 \define@key
[psset
]{pst-eqd
}{buildvector
}[true
]{\@nameuse
{Pst@buildvector
#1}}%
43 \newif\ifPst@saveData
%
44 \define@key
[psset
]{pst-eqd
}{saveData
}[true
]{\@nameuse
{Pst@saveData
#1}}%
45 \psset{method=default, whichabs=default, whichord=default, filename=datas.dat,
46 plotfuncx=default, plotfuncy=default, buildvector=false,tabname=tabValues,saveData=false
}
47 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
48 \SpecialCoor%% for using polar coordinates, node position, ...
49 \psset{dimen=middle
}% remark of ML
51 \def\@default
{default
}%
52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54 %% #3 initial value of y (which is a vector)
55 %% #4 value of the dérivative (y and t can be used)
56 \def\psequadiff{\def\pst@par
{}\pst@object
{psequadiff
}}
57 \def\psequadiff@i
#1#2#3#4{%
61 % \@nameuse{beginplot@\psplotstyle}%
68 { /len exch def
1 1 len
69 { /i exch def len i sub
2 add -
1 roll add len
2 mul i sub
1 roll
} for
} def
70 /dx x1 x sub
\psk@plotpoints div def
71 /mulvect
{ exch
1 index
{ dup
4 -
1 roll mul
2 index
2 add
1 roll
} repeat pop pop
} def
72 /divvect
{ exch
1 index
{ dup
4 -
1 roll exch div
2 index
2 add
1 roll
} repeat pop pop
} def
73 /k0
0 def /k1
0 def /k2
0 def /k3
0 def
74 \ifPst@algebraic /F@pstplot (
#4) AlgParser cvx def
\fi
76 \ifPst@algebraic F@pstplot ylength array astore
78 \ifPst@buildvector
\else y aload pop
\fi #4
79 \ifPst@buildvector
\else ylength array astore
\fi
83 \ifx\psk@method\@default
%
84 \ifx\psk@plotfuncx\@default
85 \ifx\psk@whichabs\@default x
\else y
\psk@whichabs
\space get
\fi%
86 \else\psk@plotfuncx
\space\fi%
87 \pst@number
\psxunit mul
88 y /y Func
{ dx mul
} forall y aload pop ylength addvect ylength array astore def
89 \ifx\psk@plotfuncy\@default
90 \ifx\psk@whichord\@default
0 \else\psk@whichord
\space\fi get
%
91 \else\psk@plotfuncy
\space\fi
93 \ifx\psk@plotfuncx\@default
94 \ifx\psk@whichabs\@default x
\else y
\psk@whichabs
\space get
\fi%
95 \else\psk@plotfuncx
\space\space\fi%
96 y /k0 Func
{ dx mul
} forall ylength array astore def
%% y
97 dup aload pop k0
{ 2 div
} forall ylength addvect ylength array astore /y exch def
%
98 x dup dx
2 div add /x exch def
%% y x
99 /k1 Func
{ dx mul
} forall ylength array astore def
%% y x
100 exch dup aload pop k1
{ 2 div
} forall ylength addvect y astore pop
%% x y
101 /k2 Func
{ dx mul
} forall ylength array astore def
%% x y
102 dup aload pop k2 aload pop ylength addvect y astore pop exch dup dx add /x exch def
%% y x
103 /k3 Func
{ dx mul
} forall ylength array astore def
%% y x
105 dup aload pop k0 aload pop k1 aload pop k2 aload pop ylength addvect
106 2 ylength mulvect ylength addvect k3 aload pop ylength addvect
107 6 ylength divvect ylength addvect y astore pop
108 \ifx\psk@plotfuncy\@default
109 \ifx\psk@whichord\@default
0 \else\psk@whichord
\space\fi get
%
110 \else\psk@plotfuncy
\space\fi
124 /fichierpoints (
\psk@filename) (w) file def
125 0 2 \psk@tabname
\space length
2 sub
{/i exch def
126 /xi
\psk@tabname
\space i get def
127 /yi
\psk@tabname
\space i
1 add get def
128 fichierpoints xi
15 string cvs writestring
129 fichierpoints
32 write
%% espace
130 fichierpoints yi
15 string cvs writestring
131 fichierpoints
32 write
%% espace
132 fichierpoints
10 write
%% CR
134 fichierpoints closefile
137 %\psdot[linecolor=white,dotsize=0.001](0,0)