X-Git-Url: https://melusine.eu.org/syracuse/G/git/?a=blobdiff_plain;f=gravitation%2Fpst-eqdf.tex;fp=gravitation%2Fpst-eqdf.tex;h=b4dd3cfa479cd510aa73ad2760478822666ceeb2;hb=3554b86c2df0c7aab0905e3c1ff08ad066781986;hp=0000000000000000000000000000000000000000;hpb=fda32923f8b15421e227324231c7f46c220da950;p=pst-eqdf.git diff --git a/gravitation/pst-eqdf.tex b/gravitation/pst-eqdf.tex new file mode 100644 index 0000000..b4dd3cf --- /dev/null +++ b/gravitation/pst-eqdf.tex @@ -0,0 +1,139 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -*- Mode: Latex -*- %%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% pst-eqdf.tex --- plotting of differential equations +%% Copyright 2004 Dominique RODRIGUEZ +%% +%% Author : Dominique RODRIGUEZ (EN) +%% Created the : ven avr 2 22:02:01 CEST 2004 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% HISTORY +%% +%% 2004-04-04 : creation of the file from a first LaTeX protype sty file +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\fileversion{pre-1.0} +\def\filedate{2004/03/21}% +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN +%% archives in directory macros/latex/base/lppl.txt. +%% adapation de M.Luque juin 2012 pour +%% sauvegarde de tableaux de valeurs +\message{`PST-Equadiff v\fileversion, \filedate\space (Dominique RODRIGUEZ)}% +\csname PSTEquadiffLoaded\endcsname +\let\PSTEquadiffLoaded\endinput +% Require PSTricks and pst-node packages +\ifx\PSTricksLoaded\endinput\else \input pstricks \fi +\ifx\PSTplotLoaded\endinput\else \input pst-plot.tex\fi +\ifx\PSTXKeyLoaded\endinput\else \input pst-xkey.tex \fi +\edef\PstAtCode{\the\catcode`\@}% +\catcode`\@=11\relax +% Definition of the parameters +% ---------------------------- +\pst@addfams{pst-eqd} +\define@key[psset]{pst-eqd}{method}{\edef\psk@method{#1}}% +\define@key[psset]{pst-eqd}{whichabs}{\edef\psk@whichabs{#1}}% +\define@key[psset]{pst-eqd}{whichord}{\edef\psk@whichord{#1}}% +\define@key[psset]{pst-eqd}{plotfuncx}{\edef\psk@plotfuncx{#1}}% +\define@key[psset]{pst-eqd}{plotfuncy}{\edef\psk@plotfuncy{#1}}% +\define@key[psset]{pst-eqd}{tabname}{\edef\psk@tabname{#1}}% +\define@key[psset]{pst-eqd}{filename}{\edef\psk@filename{#1}}% +\newif\ifPst@buildvector% +\define@key[psset]{pst-eqd}{buildvector}[true]{\@nameuse{Pst@buildvector#1}}% +\newif\ifPst@saveData% +\define@key[psset]{pst-eqd}{saveData}[true]{\@nameuse{Pst@saveData#1}}% +\psset[pst-eqd]{method=default, whichabs={}, whichord={}, filename=datas.dat, + plotfuncx={}, plotfuncy={}, buildvector=false, tabname=tabValues, saveData=false} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\SpecialCoor%% for using polar coordinates, node position, ... +\psset{dimen=middle}% +\def\@undef{undef}% +\def\@default{default}% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% #1-#2 x range +%% #3 initial value of y (which is a vector) +%% #4 value of the dérivative (y and t can be used) +\def\psequadiff{\def\pst@par{}\pst@object{psequadiff}} +\def\psequadiff@i#1#2#3#4{% + \pst@killglue + \begingroup + \use@par +% \addto@pscode{% +\pstVerb{ + /x #1 def + /x1 #2 def + /y [ #3 ] def + /ylength y length def + /addvect + { /len exch def 1 1 len + { /i exch def len i sub 2 add -1 roll add len 2 mul i sub 1 roll } for } def + /dx x1 x sub \psk@plotpoints div def + /mulvect { exch 1 index { dup 4 -1 roll mul 2 index 2 add 1 roll } repeat pop pop } def + /divvect { exch 1 index { dup 4 -1 roll exch div 2 index 2 add 1 roll } repeat pop pop } def + /k0 0 def /k1 0 def /k2 0 def /k3 0 def + \ifPst@algebraic /F@pstplot (#4) AlgParser cvx def \fi + /Func { + \ifPst@algebraic F@pstplot ylength array astore + \else + \ifPst@buildvector\else y aload pop \fi #4 + \ifPst@buildvector\else ylength array astore \fi + \fi + } def + /xy { + \ifx\psk@method\@default% + \ifx\psk@plotfuncx\@empty + \ifx\psk@whichabs\@empty x \else y \psk@whichabs\space get \fi% + \else\psk@plotfuncx\space\fi% +% \pst@number\psxunit mul + y /y Func { dx mul } forall y aload pop ylength addvect ylength array astore def + \ifx\psk@plotfuncy\@empty + \ifx\psk@whichord\@empty 0 \else\psk@whichord\space\fi get % + \else\psk@plotfuncy\space\fi + \else% + \ifx\psk@plotfuncx\@empty + \ifx\psk@whichabs\@empty x \else y \psk@whichabs\space get \fi% + \else\psk@plotfuncx\space\space\fi% + y /k0 Func { dx mul } forall ylength array astore def %% y + dup aload pop k0 { 2 div } forall ylength addvect ylength array astore /y exch def % + x dup dx 2 div add /x exch def %% y x + /k1 Func { dx mul } forall ylength array astore def %% y x + exch dup aload pop k1 { 2 div } forall ylength addvect y astore pop %% x y + /k2 Func { dx mul } forall ylength array astore def %% x y + dup aload pop k2 aload pop ylength addvect y astore pop exch dup dx add /x exch def %% y x + /k3 Func { dx mul } forall ylength array astore def %% y x + /x exch def %% y + dup aload pop k0 aload pop k1 aload pop k2 aload pop ylength addvect + 2 ylength mulvect ylength addvect k3 aload pop ylength addvect + 6 ylength divvect ylength addvect y astore pop + \ifx\psk@plotfuncy\@empty + \ifx\psk@whichord\@empty 0 \else\psk@whichord\space\fi get % + \else\psk@plotfuncy\space\fi + \fi + } def +/\psk@tabname[ + \psk@plotpoints { + xy + /x x dx add + def + } repeat + /x x1 def + xy + ] def +\ifPst@saveData +/fichierpoints (\psk@filename) (w) file def +0 2 \psk@tabname\space length 2 sub {/i exch def + /xi \psk@tabname\space i get def + /yi \psk@tabname\space i 1 add get def + fichierpoints xi 15 string cvs writestring + fichierpoints 32 write %% espace + fichierpoints yi 15 string cvs writestring + fichierpoints 32 write %% espace + fichierpoints 10 write %% CR +} for +fichierpoints closefile +\fi + }% + \endgroup + \ignorespaces} +%%% Local Variables: +%%% mode: latex +%%% TeX-master: t +%%% End: