summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-11-05 23:20:34 +0000
committerKarl Berry <karl@freefriends.org>2013-11-05 23:20:34 +0000
commitb5ba601a229f163d52b5f8b68a297e92e675b401 (patch)
tree60ecc9d0adc8e20495141cd3e3fa313779fe30a0
parentbb1c53dfd5963b465b5a50b11aa9ba72589c4416 (diff)
pst-ode (5nov13)
git-svn-id: svn://tug.org/texlive/trunk@32082 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/generic/pst-ode/ChangeLog8
-rw-r--r--Master/texmf-dist/doc/generic/pst-ode/pst-ode-doc.pdfbin124439 -> 125466 bytes
-rw-r--r--Master/texmf-dist/doc/generic/pst-ode/pst-ode-doc.tex24
-rw-r--r--Master/texmf-dist/dvips/pst-ode/pst-ode.pro2
-rw-r--r--Master/texmf-dist/tex/generic/pst-ode/pst-ode.tex36
5 files changed, 50 insertions, 20 deletions
diff --git a/Master/texmf-dist/doc/generic/pst-ode/ChangeLog b/Master/texmf-dist/doc/generic/pst-ode/ChangeLog
index 83d00c4b0d4..b333deaf1b5 100644
--- a/Master/texmf-dist/doc/generic/pst-ode/ChangeLog
+++ b/Master/texmf-dist/doc/generic/pst-ode/ChangeLog
@@ -1,6 +1,12 @@
+2013-11-05
+ * version 0.4
+ * fix: some variables of the main PSTricks dictionary were not available in
+ \pstODEsolve arguments (such as Pi)
+ * new: options algebraicT and algebraicAll added
+
2013-10-28
* version 0.3
- * fix: internal PS variables were visible outside (wrong stack
+ * fix: internal PS variables were visible outside (wrong dictionary stack
order)
2012-09-14
diff --git a/Master/texmf-dist/doc/generic/pst-ode/pst-ode-doc.pdf b/Master/texmf-dist/doc/generic/pst-ode/pst-ode-doc.pdf
index 22b8dc5f631..2b7f470825b 100644
--- a/Master/texmf-dist/doc/generic/pst-ode/pst-ode-doc.pdf
+++ b/Master/texmf-dist/doc/generic/pst-ode/pst-ode-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/generic/pst-ode/pst-ode-doc.tex b/Master/texmf-dist/doc/generic/pst-ode/pst-ode-doc.tex
index 16b7ee533a2..5812cf94967 100644
--- a/Master/texmf-dist/doc/generic/pst-ode/pst-ode-doc.tex
+++ b/Master/texmf-dist/doc/generic/pst-ode/pst-ode-doc.tex
@@ -80,9 +80,9 @@
%\clearpage
\begin{abstract}
- \noindent The \LPack{pstricks-add} package already provides \Lcs{psplotDiffEqn} for solving ODEs. However, as its name suggests, the macro always produces a plot of the computed result. While any number of coupled differential equations can be integrated simultaneously, only two-dimensional plots are supported. The user has to select the two components of the computed state vectors to be used in the plot. Package \LPack{pst-ode} separates solving the equations from plotting the result. The result is stored as a \PS{} object and can be plotted later using macros from other PSTricks packages, such as \Lcs{listplot} (\LPack{pst-plot}) and \Lcs{listplotThreeD} (\LPack{pst-3dplot}), or be further processed by user-defined \PS{} procedures. Optionally, the computed state vectors can be written as a table to a textfile.
+ \noindent The \LPack{pstricks-add} package already provides \Lcs{psplotDiffEqn} for solving ODEs. However, as its name suggests, the macro always produces a plot of the computed result. While any number of coupled differential equations can be integrated simultaneously, only two-dimensional plots are supported. The user has to select the two components of the computed state vectors to be used in the plot. Package \LPack{pst-ode} separates solving the equations from plotting the result. The result is stored as a \PS{} object and can be plotted later using macros from other PSTricks packages, such as \Lcs{listplot} (\LPack{pst-plot}) and \Lcs{listplotThreeD} (\LPack{pst-3dplot}), or be further processed by user-defined \PS{} procedures. Optionally, the computed state vectors can be written as a table to a text file.
-Package \LPack{pst-ode} uses the Runge-Kutta-Fehlberg (RKF45) method with automatic step size control for integrating the differential equations. Thus, the precision of the result does not depend on the number of plotpoints specified, as it would be the case with the classical Runge-Kutta (RK4) method.
+Package \LPack{pst-ode} uses the Runge-Kutta-Fehlberg (RKF45) method with automatic step size control for integrating the differential equations. Thus, the precision of the result does not depend on the number of plot points specified, as it would be the case with the classical Runge-Kutta (RK4) method.
\end{abstract}
\section{Introduction}
@@ -116,26 +116,30 @@ is the main user command for solving initial value problems.
The first mandatory argument \Larg{result} is a simple identifier composed of letters and possibly numbers. It is used to create a \PS{} object of the same name, which takes the computed state vectors $\mathbf{x}_i$, formatted according to the second argument \Larg{output format}, as a long list of values. \Larg{result} can be directly used as the \Larg{data} argument of \Lcs{listplot}\Largb{data} (package \LPack{pst-plot}) or \Lcs{listplotThreeD}\Largb{data} (package \LPack{pst-3dplot}). When put on the \PS{} operand stack, \Larg{result} is immediately executed, that is, the list of values contained in \Larg{result} is pushed onto the operand stack. The scope of \Larg{result} is global and thus its content survives page breaks.
The second argument \Larg{output format} determines which of the components of the state vectors $\mathbf{x}_i$ and possibly the independent variable $t$ are stored into \Larg{result}. \Larg{output format} can be specified in two different formats, depending on the setting of the command option \Lkeyword{algebraicOutputFormat}.
-If \Lkeyword{algebraicOutputFormat} is set, calculations can be made on the components of the computed state vectors before writing them to \Larg{result}. Without option \Lkeyword{algebraicOutputFormat} the following applies: The keyword \Lkeyword{(t)} (parentheses required) inserts the integration parameter value $t_i$ into the result list; numbers (\Lkeyword{0}, \Lkeyword{1}, \Lkeyword{2}, \dots, $n-1$) in arbitrary order specify the components of vector $\mathbf{x}_i$ to be inserted, as well as their order of insertion. The elements of \Larg{output format} are to be separated by spaces. If option \Lkeyword{algebraicOutputFormat} is set, \Larg{output format} is a \Lkeyword{|}-separated list of algebraic expressions according to which the components of the output vector are to be calculated. In these algebraic expressions, the $n$ current state vector components can be referred to as \Lkeyword{x[0]}, \Lkeyword{x[1]}, \dots, \Lkeyword{x[}$n-1$\Lkeyword{]} or \Lkeyword{y[0]}, \Lkeyword{y[1]}, \dots, \Lkeyword{y[}$n-1$\Lkeyword{]}, and the current independent variable value as `\Lkeyword{t}'. In either case, there is no upper limit of the output vector length. It must have at least one element though.
+If \Lkeyword{algebraicOutputFormat} is set, calculations can be made on the components of the computed state vectors before writing them to \Larg{result}. Without option \Lkeyword{algebraicOutputFormat} the following applies: The keyword \Lkeyword{(t)} (parentheses required) inserts the integration parameter value $t_i$ into the result list; numbers (\Lkeyword{0}, \Lkeyword{1}, \Lkeyword{2}, \dots, $n-1$) in arbitrary order specify the components of vector $\mathbf{x}_i$ to be inserted, as well as their order of insertion. The elements of \Larg{output format} are to be separated by spaces. If option \Lkeyword{algebraicOutputFormat} is set, \Larg{output format} is a \Lkeyword{|}-separated list of algebraic expressions (infix notation) according to which the components of the output vector are to be calculated. In these algebraic expressions, the $n$ current state vector components can be referred to as \Lkeyword{x[0]}, \Lkeyword{x[1]}, \dots, \Lkeyword{x[}$n-1$\Lkeyword{]} or \Lkeyword{y[0]}, \Lkeyword{y[1]}, \dots, \Lkeyword{y[}$n-1$\Lkeyword{]}, and the current independent variable value as `\Lkeyword{t}'. In either case, there is no upper limit of the output vector length. It must have at least one element though.
-Arguments $t_0$ and $t_\mathrm{e}$ define the interval of integration $I=[t_0, t_\mathrm{e}]$.
+Arguments $t_0$ and $t_\mathrm{e}$ define the interval of integration $I=[t_0, t_\mathrm{e}]$. Both arguments accept expressions in infix or \PS{} (postfix, reverse polish) notation. Infix notation requires option \Lkeyword{algebraicT}.
$N$ is the number of \emph{equally} spaced output points, including $t_0$ and $t_\mathrm{e}$; it must be $\ge 2$. In order to divide the interval of integration into $K$ output steps, $N$ must be set to $K+1$. Note that the precision of the solution does \emph{not} depend on $N$; internal integration steps are automatically inserted and resized according to the changes in the solution.
-$\mathbf{x}_0$ is a list of $n$ space separated initial values, one for each differential equation. Alternatively, $\mathbf{x}_0$ can be given as a \PS{} procedure pushing the initial values on the stack, or as an algebraic expression where the elements are separated by `\Lkeyword{|}'. Algebraic notation requires option \Lkeyword{algebraicIC}. This argument can be left empty. In that case, the last computed state vector of a preceding \Lcs{pstODEsolve} call or a state vector that was set using the \Lcs{pstODEsetOrRestoreState} macro is used as initial condition. Of course, the number of equations $n$ must be the same as in the preceding calculation.
+$\mathbf{x}_0$ is a list of $n$ space separated initial values, one for each differential equation. Alternatively, $\mathbf{x}_0$ can be given as a \PS{} procedure pushing the initial values on the stack, or as an algebraic expression in infix notation where the elements are separated by `\Lkeyword{|}'. Infix notation requires option \Lkeyword{algebraicIC}. This argument can be left empty. In that case, the last computed state vector of a preceding \Lcs{pstODEsolve} call or a state vector that was set using the \Lcs{pstODEsetOrRestoreState} macro is used as initial condition. Of course, the number of equations $n$ must be the same as in the preceding calculation.
-$\mathbf{f}(t,\mathbf{x})$ is the right-hand side of the differential equations. Equations can be entered in either algebraic or \PS{} notation. Algebraic notation requires option \Lkeyword{algebraic}, and equations have to be separated by `\Lkeyword{|}'. The $n$ current state vector components can be referred to as \Lkeyword{x[0]}, \Lkeyword{x[1]}, \dots, \Lkeyword{x[}$n-1$\Lkeyword{]} or \Lkeyword{y[0]}, \Lkeyword{y[1]}, \dots, \Lkeyword{y[}$n-1$\Lkeyword{]}, and the current independent variable value as `\Lkeyword{t}'. If given in \PS{} notation, the provided procedure must first pop the current state vector components in reverse order(!) from the operand stack and then push the first derivatives in regular order back to it. Again, the independent variable value can be accessed using `\Lkeyword{t}'.\\[1ex]
-\Lcs{pstODEsolve} accepts a few \OptArgs: \Lkeyword{append}, \Lkeyword{saveData}, \Lkeyword{algebraicOutputFormat}, \Lkeyword{algebraicIC}, \Lkeyword{algebraic}, \Lkeyword{silent} and \Lkeyword{varsteptol}.
+$\mathbf{f}(t,\mathbf{x})$ is the right-hand side of the differential equations. Equations can be entered in either infix or \PS{} (postfix, reverse polish) notation. Infix notation requires option \Lkeyword{algebraic}, and equations have to be separated by `\Lkeyword{|}'. The $n$ current state vector components can be referred to as \Lkeyword{x[0]}, \Lkeyword{x[1]}, \dots, \Lkeyword{x[}$n-1$\Lkeyword{]} or \Lkeyword{y[0]}, \Lkeyword{y[1]}, \dots, \Lkeyword{y[}$n-1$\Lkeyword{]}, and the current independent variable value as `\Lkeyword{t}'. If given in \PS{} notation, the provided procedure must first pop the current state vector components in reverse order(!) from the operand stack and then push the first derivatives in regular order back to it. Again, the independent variable value can be accessed using `\Lkeyword{t}'.\\[1ex]
+\Lcs{pstODEsolve} accepts a few \OptArgs: \Lkeyword{append}, \Lkeyword{saveData}, \Lkeyword{algebraicOutputFormat}, \Lkeyword{algebraicIC}, \Lkeyword{algebraicT}, \Lkeyword{algebraic}, \Lkeyword{algebraicAll}, \Lkeyword{silent} and \Lkeyword{varsteptol}.
With \Lkeyword{append}, the computed result is appended to \Larg{result} which must already exist, e.\, g. from a previous use of \Lcs{pstODEsolve}. Usually, the initial condition vector argument is left empty in order to continue integration from the last computed or from a restored state (see \Lcs{pstODEsetOrRestoreState}).
If option \Lkeyword{saveData} is set, the formatted state vectors are written as a table to a textfile named `\Larg{result}\Lkeyword{.dat}'. Note that \Lkeyword{ps2pdf} must be called with option \Lkeyword{-dNOSAFER} to enable writing of external files.
-With \Lkeyword{algebraicOutputFormat}, the command argument \Larg{output format} is a \Lkeyword{|}-separated list of algebraic expressions, according to which the output vector components are to be assembled before storing them into \Larg{result}. Default is not to use algebraic expressions. For details, see the description of \Larg{output format} above.
+With \Lkeyword{algebraicOutputFormat}, the command argument \Larg{output format} is a \Lkeyword{|}-separated list of algebraic expressions in infix notation, according to which the output vector components are to be assembled before storing them into \Larg{result}. Default is to not use algebraic infix expressions. For details, see the description of \Larg{output format} above.
-With \Lkeyword{algebraicIC}, the initial condition vector $\mathbf{x}_0$ can be given in algebraic notation. Vector components have to be separated by `\Lkeyword{|}'. Default is \PS{} notation.
+With \Lkeyword{algebraicT}, the integration interval limits $t_0$ and $t_\mathrm{e}$ can be entered as algebraic expressions in infix notation, otherwise \PS{} (postfix, reverse polish) notation must be used. Of course, single rational numbers for $t_0$ and $t_\mathrm{e}$ always work.
-With \Lkeyword{algebraic}, the right-hand side of differential equations $\mathbf{f}(t,\mathbf{x})$ can be given in algebraic notation. Algebraic expressions are to be separated by `\Lkeyword{|}'. Default is \PS{} notation.
+With \Lkeyword{algebraicIC}, the initial condition vector $\mathbf{x}_0$ can be given in algebraic infix notation. Vector components have to be separated by `\Lkeyword{|}'. Default is \PS{} notation, i.\,e. space separated postfix expressions or rational numbers.
+
+With \Lkeyword{algebraic}, the right-hand side of differential equations $\mathbf{f}(t,\mathbf{x})$ can be given in infix notation. Algebraic infix expressions are to be separated by `\Lkeyword{|}'. Default is \PS{} notation.
+
+Option \Lkeyword{algebraicAll} is equivalent to setting all of \Lkeyword{algebraicOutputFormat}, \Lkeyword{algebraicIC}, \Lkeyword{algebraicT}, \Lkeyword{algebraic}.
Option \Lkeyword{silent} suppresses the terminal output of stepping information.
diff --git a/Master/texmf-dist/dvips/pst-ode/pst-ode.pro b/Master/texmf-dist/dvips/pst-ode/pst-ode.pro
index 1677e23a6bd..ee71a6525c2 100644
--- a/Master/texmf-dist/dvips/pst-ode/pst-ode.pro
+++ b/Master/texmf-dist/dvips/pst-ode/pst-ode.pro
@@ -1,7 +1,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% PostScript prologue for pst-ode.tex.
-% Version 0.3, 2013/10/28
+% Version 0.4, 2013/11/05
%
% Alexander Grahn (C) 2012, 2013
%
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 b183a7742d7..1d10cb31c2b 100644
--- a/Master/texmf-dist/tex/generic/pst-ode/pst-ode.tex
+++ b/Master/texmf-dist/tex/generic/pst-ode/pst-ode.tex
@@ -11,8 +11,8 @@
%% ODEs using the Runge-Kutta-Fehlberg (RKF45) method with automatic
%% step size adjustment
%%
-\def\fileversion{0.3}
-\def\filedate{2013/10/28}
+\def\fileversion{0.4}
+\def\filedate{2013/11/05}
\csname PSTODELoaded\endcsname
\let\PSTODELoaded\endinput
@@ -54,6 +54,10 @@
% * saveData result is written to file <result>.dat
% * algebraic (system of) ODE given in infix notation
% * algebraicIC initial condition vector given in infix notation
+% * algebraicT integration interval limits ta, tb given in infix notation
+% * algebraicOutputFormat output vector format given in infix notation
+% * algebraicAll output vector format, ta, tb, initial cond., function given
+% in infix notation
% * silent suppress output of stepping information
% * varsteptol relative tolerance for step size adjustment
%
@@ -79,10 +83,12 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\define@boolkey[psset]{pst-ode}[Pst@]{append}[true]{}%
\define@boolkey[psset]{pst-ode}[Pst@]{saveData}[true]{}%
+\define@boolkey[psset]{pst-ode}[Pst@]{algebraicT}[true]{}%
\define@boolkey[psset]{pst-ode}[Pst@]{algebraicIC}[true]{}%
+\define@boolkey[psset]{pst-ode}[Pst@]{algebraicOutputFormat}[true]{}%
+\define@boolkey[psset]{pst-ode}[Pst@]{algebraicAll}[true]{}%
\define@boolkey[psset]{pst-ode}[Pst@]{algebraic}[true]{}%
\define@boolkey[psset]{pst-ode}[Pst@]{silent}[true]{}%
-\define@boolkey[psset]{pst-ode}[Pst@]{algebraicOutputFormat}[true]{}%
\define@key[psset]{pst-ode}{varsteptol}{\def\ode@varsteptol{#1}}%
\def\pstODEsolve{\def\pst@par{}\pst@object{pstODEsolve}}%
\def\pstODEsolve@i#1#2#3#4#5#6#7{%
@@ -91,9 +97,17 @@
\use@par%
\def\filemode{w}%
\ifPst@append\def\filemode{a}\fi%
+ \edef\ode@ta{#3{}}%
+ \edef\ode@tb{#4{}}%
\edef\ode@init{#6{}}%
\edef\ode@init{\expandafter\ode@zapspace\ode@init\@nil}%
\edef\ode@arg{#7{}}%
+ \ifPst@algebraicAll%
+ \Pst@algebraicTtrue%
+ \Pst@algebraicICtrue%
+ \Pst@algebraicOutputFormattrue%
+ \Pst@algebraictrue%
+ \fi%
\ifPst@algebraicOutputFormat\edef\ode@fmt{#2{}}\fi%
\pstVerb{
tx@odeDict begin
@@ -105,8 +119,13 @@
/ode@tol \ode@varsteptol\space def % rel. tolerance for step size adjustment
%process arguments
\ifPst@saveData /statefile (#1.dat) (\filemode) file def \fi
- /tStart #3 def
- /tEnd #4 def
+ \ifPst@algebraicT
+ /tStart tx@Dict begin (\expandafter\ode@zapspace\ode@ta\@nil) AlgParser cvx exec end def
+ /tEnd tx@Dict begin (\expandafter\ode@zapspace\ode@tb\@nil) AlgParser cvx exec end def
+ \else
+ /tStart tx@Dict begin #3 end def
+ /tEnd tx@Dict begin #4 end def
+ \fi
/dt tEnd tStart sub #5\space 1 sub div def % output step size
\ifx\@empty#6\@empty\else
\ifPst@algebraicIC
@@ -123,7 +142,7 @@
/xlength ode@laststate length def % number of equations
/xlength1 xlength 1 add def % number of equations plus 1
\ifPst@algebraic
- /ode@rpn (\expandafter\ode@zapspace\ode@arg\@nil) AlgParser cvx bind def
+ /ode@rpn tx@Dict begin (\expandafter\ode@zapspace\ode@arg\@nil) AlgParser end cvx bind def
/ODESET {%system of ODEs
/x exch def /y x def tx@Dict begin ode@rpn end xlength array astore
} bind def
@@ -135,7 +154,7 @@
/ODESET load 4 1 dict put
\fi
\ifPst@algebraicOutputFormat
- /ode@fmtrpn (\expandafter\ode@zapspace\ode@fmt\@nil) AlgParser cvx bind def
+ /ode@fmtrpn tx@Dict begin (\expandafter\ode@zapspace\ode@fmt\@nil) AlgParser end cvx bind def
/formatoutput {%
ode@laststate /x exch def /y x def /t tcur def
tx@Dict begin ode@fmtrpn end
@@ -201,8 +220,9 @@
}%
}
-\psset[pst-ode]{append=false,saveData=false,algebraicIC=false,
+\psset[pst-ode]{append=false,saveData=false,algebraicIC=false,algebraicT=false,
algebraic=false,silent=false,varsteptol=1e-6,algebraicOutputFormat=false,
+ algebraicAll=false
}
\catcode`\@=\PstAtCode\relax