summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pst-ode
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-08-17 21:17:38 +0000
committerKarl Berry <karl@freefriends.org>2017-08-17 21:17:38 +0000
commitb8ff3abffd353bbb67365864f1abdf3c9ff91fa1 (patch)
treee29d0928850844977dce538d50a836a48631b446 /Master/texmf-dist/tex/generic/pst-ode
parent9d52a67c4dd12d828f99b735ed4970f3d338cb24 (diff)
pst-ode (17aug17)
git-svn-id: svn://tug.org/texlive/trunk@45057 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pst-ode')
-rw-r--r--Master/texmf-dist/tex/generic/pst-ode/pst-ode.tex54
1 files changed, 39 insertions, 15 deletions
diff --git a/Master/texmf-dist/tex/generic/pst-ode/pst-ode.tex b/Master/texmf-dist/tex/generic/pst-ode/pst-ode.tex
index d8f4e9eccca..8516529f91a 100644
--- a/Master/texmf-dist/tex/generic/pst-ode/pst-ode.tex
+++ b/Master/texmf-dist/tex/generic/pst-ode/pst-ode.tex
@@ -4,15 +4,15 @@
%% Alexander Grahn, (C) 2012--today
%%
%% 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.
+%% of the LaTeX Project Public License Distributed from CTAN archives:
+%% http://mirrors.ctan.org/tex-archive/macros/latex/base/lppl.txt
%%
%% `pst-ode' defines \pstODEsolve for integrating systems of first order
%% ODEs using the Runge-Kutta-Fehlberg (RKF45) method with automatic
%% step size adjustment
%%
-\def\fileversion{0.10}
-\def\filedate{2017/06/16}
+\def\fileversion{0.11}
+\def\filedate{2017/08/15}
\csname PSTODELoaded\endcsname
\let\PSTODELoaded\endinput
@@ -60,6 +60,8 @@
% in infix notation
% * silent suppress output of stepping information
% * varsteptol relative tolerance for step size adjustment
+% * dt0 first tentative integration step size, overrides output step
+% size (#4-#3)/(#5-1) used as default value
%
% arguments:
%
@@ -89,6 +91,7 @@
\define@boolkey[psset]{pst-ode}[PstODE@]{algebraicAll}[true]{}%
\define@boolkey[psset]{pst-ode}[PstODE@]{silent}[true]{}%
\define@key[psset]{pst-ode}{varsteptol}{\def\ode@varsteptol{#1}}%
+\define@key[psset]{pst-ode}{dt0}{\def\ode@dtInit{#1}}%
\def\pstODEsolve{\def\pst@par{}\pst@object{pstODEsolve}}%
\def\pstODEsolve@i#1#2#3#4#5#6#7{%
\pst@killglue%
@@ -129,7 +132,7 @@
tx@Dict begin 1 dict begin #4 end end ode@dict /tEnd exch def end
\fi
ode@dict /dt tEnd tStart sub #5\space 1 sub div def end % output step size
- \ifx\@empty#6\@empty\else
+ \ifx\@empty\ode@init\@empty\else
\ifPstODE@algebraicIC
true setglobal globaldict /ode@laststate [
tx@Dict begin (\ode@init) AlgParser cvx
@@ -164,11 +167,21 @@
\else /formatoutput {[#2] assembleresult} def \fi%
%perform ode integration
(\string\n pstODEsolve (RKF45),\string\n) odeprint
- (-/+ failed/successful step; "o" output step; "!" step size underflow (stop):\string\n) odeprint
+ (-/+ failed/successful step, "o" output step, "!" step size underflow (stop):\string\n) odeprint
ode@dict
/tcur tStart def % current parameter t value
+ /outStepCnt 1 def % output step counter
/tout tStart dt add def % next output t
- /ddt dt def % initial integration step size
+ %initial integration step size `ddt': either same as first output step
+ % size `dt' or last from previous solution (empty initial condition) or
+ % user provided (option `dt0')
+ \ifx\@empty\ode@init\@empty
+ \ode@dtInit\space 0 eq
+ {/ddt ode@ddt def}{/ddt \ode@dtInit\space def} ifelse
+ \else
+ \ode@dtInit\space 0 eq
+ {/ddt dt def}{/ddt \ode@dtInit\space def} ifelse
+ \fi
end
\ifPstODE@append\else
[
@@ -191,6 +204,10 @@
true setglobal
]
globaldict exch /#1 exch cvx put
+ globaldict /ode@dt ode@dict dt end put
+ globaldict /ode@ddt ode@dict ddt end put
+ globaldict /ode@tcur ode@dict tcur end put
+ globaldict /ode@tout ode@dict tout end put
false setglobal
} repeat (\string\n) odeprint
\ifPstODE@saveData statefile closefile \fi
@@ -205,27 +222,34 @@
\ifx\@empty#2\@empty\else\ode@zapspace#2\@nil\fi%
}
-%macro for saving last state vector into PS object
+%macro for saving last state
\def\pstODEsaveState#1{% #1: identifier
\pstVerb{
true setglobal
- globaldict /#1 [ode@laststate cvx exec] cvx put
+ globaldict /#1@ode@laststate [ode@laststate cvx exec] cvx put
+ globaldict /#1@ode@dt ode@dt put
+ globaldict /#1@ode@ddt ode@ddt put
+ globaldict /#1@ode@tcur ode@tcur put
+ globaldict /#1@ode@tout ode@tout put
false setglobal
}%
}
-%macro for restoring state vector from PS object or setting it from
-%literal vector
-\def\pstODEsetOrRestoreState#1{% #1: identifier or
- \pstVerb{ % space separated list of numbers
+%macro for restoring state
+\def\pstODERestoreState#1{% #1: identifier
+ \pstVerb{
true setglobal
- globaldict /ode@laststate [#1] put
+ globaldict /ode@laststate [#1@ode@laststate] put
+ globaldict /ode@dt #1@ode@dt put
+ globaldict /ode@ddt #1@ode@ddt put
+ globaldict /ode@tcur #1@ode@tcur put
+ globaldict /ode@tout #1@ode@tout put
false setglobal
}%
}
\psset[pst-ode]{append=false,saveData=false,algebraicIC=false,algebraicT=false,
- silent=false,varsteptol=1e-6,algebraicOutputFormat=false,algebraicAll=false
+ silent=false,varsteptol=1e-6,algebraicOutputFormat=false,algebraicAll=false,dt0=0
}
\psset{algebraic=false}
\catcode`\@=\PstAtCode\relax