diff options
author | Karl Berry <karl@freefriends.org> | 2022-11-24 20:39:29 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-11-24 20:39:29 +0000 |
commit | 357637f662b6d1e080a92685dc01102ba935157b (patch) | |
tree | 435e643680ead9a251d342d34b30fc90f6d594c2 /Master/texmf-dist/tex/generic | |
parent | bee9ff1e4cba6801c731af8e5ce1d8c01db64e32 (diff) |
pst-ode (24nov22)
git-svn-id: svn://tug.org/texlive/trunk@65096 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic')
-rw-r--r-- | Master/texmf-dist/tex/generic/pst-ode/pst-ode.tex | 24 |
1 files changed, 18 insertions, 6 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 7cb0e895733..3ab38399c38 100644 --- a/Master/texmf-dist/tex/generic/pst-ode/pst-ode.tex +++ b/Master/texmf-dist/tex/generic/pst-ode/pst-ode.tex @@ -12,8 +12,8 @@ %% ODEs using the Runge-Kutta-Fehlberg (RKF45) method with automatic %% step size adjustment %% -\def\fileversion{0.17} -\def\filedate{2022/05/14} +\def\fileversion{0.18} +\def\filedate{2022/11/24} \csname PSTODELoaded\endcsname \let\PSTODELoaded\endinput @@ -64,6 +64,8 @@ % * 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 +% * rk4 instead of RKF45, use 4th-order classical Runge-Kutta between +% output points (without adaptive step size) % % arguments: % @@ -87,6 +89,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \define@boolkey[psset]{pst-ode}[PstODE@]{append}[true]{}% \define@boolkey[psset]{pst-ode}[PstODE@]{saveData}[true]{}% +\define@boolkey[psset]{pst-ode}[PstODE@]{rk4}[true]{}% \define@boolkey[psset]{pst-ode}[PstODE@]{algebraicT}[true]{}% \define@boolkey[psset]{pst-ode}[PstODE@]{algebraicN}[true]{}% \define@boolkey[psset]{pst-ode}[PstODE@]{algebraicIC}[true]{}% @@ -126,6 +129,9 @@ \fi /ode@tol \ode@varsteptol\space def % rel. tolerance for step size adjustment %process arguments + /rk4 + \expandafter\csname ifPstODE@rk4\endcsname true\else false\fi\space + def \ifPstODE@saveData /statefile (#1.dat) (\filemode) file def \fi \ifPstODE@algebraicT tx@Dict begin (\expandafter\ode@zapspace\ode@ta\@nil) @@ -175,10 +181,14 @@ ode@dict ode@laststate /x exch def /y x def /t tcur def end tx@Dict begin ode@dict ode@fmtrpn end end } bind def - \else /formatoutput {[#2] assembleresult} def \fi% + \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 + rk4 { + (\string\n pstODEsolve (RK4),) odeprint ( "o" output step:\string\n) odeprint + }{ + (\string\n pstODEsolve (RKF45),\string\n) odeprint + (-/+ failed/successful step, "o" output step, "!" step size underflow (stop):\string\n) odeprint + } ifelse ode@dict /tcur tStart def % current parameter t value /outStepCnt 1 def % output step counter @@ -193,6 +203,8 @@ \ode@dtInit\space 0 eq {/ddt dt def}{/ddt \ode@dtInit\space def} ifelse \fi + % for RK4, use output step size + rk4 {/ddt dt def} if end \ifPstODE@append\else [ @@ -261,7 +273,7 @@ \psset[pst-ode]{append=false,saveData=false,algebraicIC=false,algebraicT=false, algebraicN=false,silent=false,varsteptol=1e-6,algebraicOutputFormat=false, - algebraicAll=false,dt0=0 + algebraicAll=false,dt0=0,rk4=false } \psset{algebraic=false} \catcode`\@=\PstAtCode\relax |