summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/animate/animate.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-07-24 00:42:34 +0000
committerKarl Berry <karl@freefriends.org>2009-07-24 00:42:34 +0000
commit09d56956642d597b0e464ac3bfb4c46494ba5635 (patch)
treea6c91cd23aa3cbd20781f633d5da5c893a869953 /Master/texmf-dist/doc/latex/animate/animate.tex
parentc33e102590bf67a8940ad14cbc6ad5550bb236fa (diff)
animate update (23jul09)
git-svn-id: svn://tug.org/texlive/trunk@14420 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/animate/animate.tex')
-rw-r--r--Master/texmf-dist/doc/latex/animate/animate.tex71
1 files changed, 38 insertions, 33 deletions
diff --git a/Master/texmf-dist/doc/latex/animate/animate.tex b/Master/texmf-dist/doc/latex/animate/animate.tex
index dc85043e06c..c54be2180b6 100644
--- a/Master/texmf-dist/doc/latex/animate/animate.tex
+++ b/Master/texmf-dist/doc/latex/animate/animate.tex
@@ -343,8 +343,8 @@ The layer concept is best illustrated by an example. In the timeline of Table~\r
\begin{tabular}[t]{c|l|c}\hline
frame No. & timeline file & transparency stack\\\hline\hline
\multirow{3}{*}{0} & \multirow{3}{*}{\tt::\ \ 0x0 ; 2x0} & ---------2---------\\&&{\tiny\dotfill}\\&&---------0---------\\\cline{1-1}\cline{3-3}
-\multirow{6}{*}{1} & \multirow{6}{*}{\tt::\ \ 7,8 ; 3x0} & ---------3---------\\&&---------2---------\\&&\tiny\dotfill\\&&---------8---------\\&&---------7---------\\&&---------0---------\\\cline{1-1}\cline{3-3}
-\multirow{5}{*}{2} & \multirow{5}{*}{\tt::\ \ \ \ \ \ ; 4x0} & ---------4---------\\&&---------3---------\\&&---------2---------\\&&\tiny\dotfill\\&&---------0---------\\\cline{1-1}\cline{3-3}
+\multirow{6}{*}{1} & \multirow{6}{*}{\tt::7,8x2 ; 3x0} & ---------3---------\\&&---------2---------\\&&\tiny\dotfill\\&&---------8---------\\&&---------7---------\\&&---------0---------\\\cline{1-1}\cline{3-3}
+\multirow{6}{*}{2} & \multirow{6}{*}{\tt::\ \ \ \ \ \ ; 4x0} & ---------4---------\\&&---------3---------\\&&---------2---------\\&&\tiny\dotfill\\&&---------8---------\\&&---------0---------\\\cline{1-1}\cline{3-3}
\multirow{6}{*}{3} & \multirow{6}{*}{\tt::c,1x0 ; 5x0} & ---------5---------\\&&---------4---------\\&&---------3---------\\&&---------2---------\\&&\tiny\dotfill\\&&---------1---------\\\cline{1-1}\cline{3-3}
\multirow{7}{*}{4} & \multirow{7}{*}{\tt::\ \ \ \ \ \ ; 6x0} & ---------6---------\\&&---------5---------\\&&---------4---------\\&&---------3---------\\&&---------2---------\\&&\tiny\dotfill\\&&---------1---------\\\hline
\end{tabular}
@@ -595,11 +595,11 @@ Another inline example, Fig.~\ref{fig:lorenz}, is an animation of the Lorenz Att
\end{align*}
with respect to the independent parameter $t$. The shape of the attractor strongly depends on the values chosen for the coefficients $\alpha$, $\beta$ and $\gamma$ as well as on the initial conditions, that is, the coordinates $x_0$, $y_0$ and $z_0$ of the starting point of the curve. Here we use the values $\alpha=10$, $\beta=28$, $\gamma=8/3$ and the starting point $\mathbf{x}_0=(3,15,1)$.
-The right hand sides of the equations above are implemented in the Postscript procedure `\verb+lorenz+' which is passed to the macro \verb+\odesolve+. The latter implements the Runge-Kutta method for integrating sets of ordinary differential equations. Its core is also written in Postscript. Hence, the computation of the curve is performed by the Postscript interpreter while converting the PS document into PDF. The solution vectors $\mathbf{x}(t)$ are written to a text file subsequently read by the macro \verb+\parametricplotThreeD+ from the PSTricks package `pst-3dplot' in order to plot the curve. Note that the creation of intermediate files requires the Postscript interpreter to be run in unsafe mode. In the case of Ghostscript, option `\verb+-dNOSAFER+' must be passed to \verb+ps2pdf+.
+The right hand sides of the equations above are implemented in the Postscript procedure `\verb+lorenz+' which is passed to the macro \verb+\odesolve+. The latter implements the Runge-Kutta method for integrating sets of ordinary differential equations. Its core is also written in Postscript. Hence, the computation of the curve is performed by the Postscript interpreter while converting the PS document into PDF. The solution vectors $\mathbf{x}(t)$ are written to a text file subsequently read by the macro \verb+\parametricplotThreeD+ from the PSTricks package `pst-3dplot' in order to plot the curve. Note that the creation of intermediate files requires the Postscript interpreter to be run in unsafe mode. In the case of Ghostscript, option `\verb+-dNOSAFER+' must be passed to \verb+ps2pdf+. Feel free to copy the code of \verb+\odesolve+ verbatim in order to solve your own initial value problems.
-A timeline file, written on-the-fly, is used to assemble the curve segments frame by frame to the growing attractor which, in turn, is put on top of the $x$-$y$-$z$ coordinate system. After the attractor has been completed, the transparency stack is cleared. Then, transparencies containing the complete curve and the coordinate system seen from different points of view are put in a row to produce the animated fly-around.
+A timeline file, written on-the-fly, is used to assemble the curve segments frame by frame to the growing attractor which, in turn, is put on top of the $x$-$y$-$z$ coordinate system. After the attractor has been completed, the transparency stack is cleared. Then, transparencies containing the complete curve and the coordinate system seen from different viewpoints are put in a row to produce the animated fly-around.
-\begin{figure}
+\begin{figure}[t]
\centering
\makeatletter%
\def\odesolve{\@ifstar{\@odesolve[append]}{\@odesolve}}%
@@ -622,13 +622,12 @@ A timeline file, written on-the-fly, is used to assemble the curve segments fram
/dt2 dt 2 div def % half step size
\initcond %set initial state vector
/xlength laststate length def % number of equations
- /ODESET { cvx exec #8 xlength array astore } def %system of ode's
+ /xlength1 xlength 1 add def % number of equations plus 1
+ /ODESET { cvx exec #8 xlength array astore } def %system of ODEs
/addvect { % [1 2 3] [4 5 6] addvect => [5 7 9]
- 0 1 xlength 1 sub {
- /i exch def
- dup i get 3 -1 roll
- dup i get exch 4 1 roll add 3 1 roll
- } for pop pop xlength array astore
+ cvx exec xlength1 -1 roll
+ {xlength1 -1 roll add} forall
+ xlength array astore
} def
/mulvect { % [1 2 3] 4 mulvect => [4 8 12]
/mul cvx 2 array astore cvx forall xlength array astore
@@ -640,10 +639,10 @@ A timeline file, written on-the-fly, is used to assemble the curve segments fram
% [ state vector x(t) ] RK => [ state vector x(t + dt) ]
dup ODESET /k0 exch def
t dt2 add /t exch def
- dup k0 {dt2 mul} forall xlength array astore addvect ODESET /k1 exch def
- dup k1 {dt2 mul} forall xlength array astore addvect ODESET /k2 exch def
+ dup k0 dt2 mulvect addvect ODESET /k1 exch def
+ dup k1 dt2 mulvect addvect ODESET /k2 exch def
t dt2 add /t exch def
- dup k2 {dt mul} forall xlength array astore addvect ODESET /k3 exch def
+ dup k2 dt mulvect addvect ODESET /k3 exch def
k0 k1 2 mulvect addvect k2 2 mulvect addvect k3 addvect
6 divvect dt mulvect addvect
} def
@@ -659,7 +658,7 @@ A timeline file, written on-the-fly, is used to assemble the curve segments fram
statefile (\string\n) writestring
} def
\append\space not {output} if
- laststate #6\space 1 sub {RK dup /laststate exch def output} repeat pop
+ #6\space 1 sub {laststate RK /laststate exch def output} repeat
statefile closefile
}%
}%
@@ -726,13 +725,20 @@ A timeline file, written on-the-fly, is used to assemble the curve segments fram
\usepackage{pstricks-add}
\usepackage{animate}
+\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% odesolve
+%
+% LaTeX command for integrating systems of first order ODEs using the Runge-
+% Kutta method; values of the integration parameter `t' as well as the solution
+% (= state) vectors are written to a text file
+%
+% Usage:
+%
% \odesolve{filename}{output vector}{ta}{tb}{nodes}{initial cond.}{function}
% \odesolve*{filename}{output vector}{ta}{tb}{nodes}{initial cond.}{function}
%
-% LaTeX command for integrating systems of first order ODE's using Runge-Kutta
-% method; values of the integration parameter `t' as well as the solution
-% (= state) vectors are written to a text file
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% #1: output filename for solution data
% #2: output vector format, e. g. `(t) 0 1'; specifies which data to be written
@@ -751,7 +757,6 @@ A timeline file, written on-the-fly, is used to assemble the curve segments fram
% \odesolve* --> computed data are appended to existing data file (arg. #1)
% rather than overwriting it
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\makeatletter
\def\odesolve{\@ifstar{\@odesolve[append]}{\@odesolve}}
\newcommand{\@odesolve}[8][]{%
\def\append{false}%
@@ -763,7 +768,7 @@ A timeline file, written on-the-fly, is used to assemble the curve segments fram
\ifthenelse{\equal{#7}{}}{}{%
\def\initcond{/laststate [#7] def}%
}%
- \pstVerb{
+ \pstVerb{%
/statefile (#2) (\filemode) file def
/outvect [#3] def
/t #4 def
@@ -772,13 +777,12 @@ A timeline file, written on-the-fly, is used to assemble the curve segments fram
/dt2 dt 2 div def % half step size
\initcond %set initial state vector
/xlength laststate length def % number of equations
- /ODESET { cvx exec #8 xlength array astore } def %system of ode's
+ /xlength1 xlength 1 add def % number of equations plus 1
+ /ODESET { cvx exec #8 xlength array astore } def %system of ODEs
/addvect { % [1 2 3] [4 5 6] addvect => [5 7 9]
- 0 1 xlength 1 sub {
- /i exch def
- dup i get 3 -1 roll
- dup i get exch 4 1 roll add 3 1 roll
- } for pop pop xlength array astore
+ cvx exec xlength1 -1 roll
+ {xlength1 -1 roll add} forall
+ xlength array astore
} def
/mulvect { % [1 2 3] 4 mulvect => [4 8 12]
/mul cvx 2 array astore cvx forall xlength array astore
@@ -790,10 +794,10 @@ A timeline file, written on-the-fly, is used to assemble the curve segments fram
% [ state vector x(t) ] RK => [ state vector x(t + dt) ]
dup ODESET /k0 exch def
t dt2 add /t exch def
- dup k0 {dt2 mul} forall xlength array astore addvect ODESET /k1 exch def
- dup k1 {dt2 mul} forall xlength array astore addvect ODESET /k2 exch def
+ dup k0 dt2 mulvect addvect ODESET /k1 exch def
+ dup k1 dt2 mulvect addvect ODESET /k2 exch def
t dt2 add /t exch def
- dup k2 {dt mul} forall xlength array astore addvect ODESET /k3 exch def
+ dup k2 dt mulvect addvect ODESET /k3 exch def
k0 k1 2 mulvect addvect k2 2 mulvect addvect k3 addvect
6 divvect dt mulvect addvect
} def
@@ -809,10 +813,11 @@ A timeline file, written on-the-fly, is used to assemble the curve segments fram
statefile (\string\n) writestring
} def
\append\space not {output} if
- laststate #6\space 1 sub {RK dup /laststate exch def output} repeat pop
+ #6\space 1 sub {laststate RK /laststate exch def output} repeat
statefile closefile
}%
}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatother
\begin{document}
@@ -823,9 +828,9 @@ A timeline file, written on-the-fly, is used to assemble the curve segments fram
%get elements of current state vector
/varz exch def /vary exch def /varx exch def
%
- 10 vary varx sub mul %dx/dt
- varx 28 varz sub mul %dy/dt
- varx vary mul 8 3 div varz mul sub %dz/dt
+ 10 vary varx sub mul %dx/dt
+ varx 28 varz sub mul %dy/dt
+ varx vary mul 8 3 div varz mul sub %dz/dt
} def
}%
%