diff options
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/mfpic4ode/demo/demo.pdf | bin | 229781 -> 221236 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/mfpic4ode/demo/demo.tex | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/mfpic4ode/mfpic4ode.pdf | bin | 112722 -> 113843 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/mfpic4ode/mfpic4ode.tex | 155 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/mfpic4ode/mfpic4ode.dtx | 180 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/mfpic4ode/mfpic4ode.sty | 2 |
6 files changed, 186 insertions, 153 deletions
diff --git a/Master/texmf-dist/doc/latex/mfpic4ode/demo/demo.pdf b/Master/texmf-dist/doc/latex/mfpic4ode/demo/demo.pdf Binary files differindex ac85af20cbc..256f443f0bd 100644 --- a/Master/texmf-dist/doc/latex/mfpic4ode/demo/demo.pdf +++ b/Master/texmf-dist/doc/latex/mfpic4ode/demo/demo.pdf diff --git a/Master/texmf-dist/doc/latex/mfpic4ode/demo/demo.tex b/Master/texmf-dist/doc/latex/mfpic4ode/demo/demo.tex index e948ab6374e..0a56345461a 100644 --- a/Master/texmf-dist/doc/latex/mfpic4ode/demo/demo.tex +++ b/Master/texmf-dist/doc/latex/mfpic4ode/demo/demo.tex @@ -193,7 +193,7 @@ Runge--Kutta and fourth order Runge--Kutta method. \nomplabels \drawcolor{green} \mfsrc{ODEstep:=0.02; ODEstepcount:=30;} - \trajectoryRKF{0}{1} + \dashed\trajectoryRKF{0}{1} \tlabel[tr](0.39,2.4){\bf{Exact solution}} % We use bigger step to see the difference between various diff --git a/Master/texmf-dist/doc/latex/mfpic4ode/mfpic4ode.pdf b/Master/texmf-dist/doc/latex/mfpic4ode/mfpic4ode.pdf Binary files differindex ac4f81f6c90..1d6364ccfec 100644 --- a/Master/texmf-dist/doc/latex/mfpic4ode/mfpic4ode.pdf +++ b/Master/texmf-dist/doc/latex/mfpic4ode/mfpic4ode.pdf diff --git a/Master/texmf-dist/doc/latex/mfpic4ode/mfpic4ode.tex b/Master/texmf-dist/doc/latex/mfpic4ode/mfpic4ode.tex index a20ce6c6131..a20dcb81c35 100644 --- a/Master/texmf-dist/doc/latex/mfpic4ode/mfpic4ode.tex +++ b/Master/texmf-dist/doc/latex/mfpic4ode/mfpic4ode.tex @@ -38,51 +38,60 @@ %%% ODEstep and the number of steps is ODEstepcount. The points are %%% stored in metapost variables x1,y1. \def\trajectory#1#2{ - \mfsrc{x1:=#1;y1:=#2; - for i=1 upto ODEstepcount: - x2:=x1+ODEstep; - y2:=y1+ODEstep*ODErhs(x1,y1);} - \ODEline{z1}{z2} - \mfsrc{ - if ((y2>yneg) and (y2<ypos)): x1:=x2; y1:=y2 fi; - endfor - }} + \begin{connect} + \mfsrc{x1:=#1;y1:=#2; + for i=1 upto ODEstepcount: + x2:=x1+ODEstep; + y2:=y1+ODEstep*ODErhs(x1,y1);} + \ODEline{z1}{z2} + \mfsrc{ + if ((y2>yneg) and (y2<ypos)): x1:=x2; y1:=y2 fi; + endfor + } + \end{connect} +} %%% Integral curve using Runge--Kutta method. \def\trajectoryRK#1#2{ - \mfsrc{x1:=#1;y1:=#2; - for i=1 upto ODEstepcount: - k1:=ODErhs(x1,y1); - x3:=x1+(ODEstep/2); - y3:=y1+k1*(ODEstep/2); - k2:=ODErhs(x3,y3); - x2:=x1+ODEstep; - y2:=y1+ODEstep*k2;} - \ODEline{z1}{z2} - \mfsrc{ - if ((y2>yneg) and (y2<ypos)): x1:=x2; y1:=y2 fi; - endfor - }} + \begin{connect} + \mfsrc{x1:=#1;y1:=#2; + for i=1 upto ODEstepcount: + k1:=ODErhs(x1,y1); + x3:=x1+(ODEstep/2); + y3:=y1+k1*(ODEstep/2); + k2:=ODErhs(x3,y3); + x2:=x1+ODEstep; + y2:=y1+ODEstep*k2;} + \ODEline{z1}{z2} + \mfsrc{ + if ((y2>yneg) and (y2<ypos)): x1:=x2; y1:=y2 fi; + endfor + } + \end{connect} +} %%% Integral curve using fourth order Runge--Kutta method. \def\trajectoryRKF#1#2{ - \mfsrc{x1:=#1;y1:=#2; - for i=1 upto ODEstepcount: - k1:=ODErhs(x1,y1); - x3:=x1+(ODEstep/2); - y3:=y1+k1*(ODEstep/2); - k2:=ODErhs(x3,y3); - y4:=y1+k2*(ODEstep/2); - k3:=ODErhs(x3,y4); - y5:=y1+k3*(ODEstep/2); - k4:=ODErhs(x3,y5); - kk:=(k1+2*k2+2*k3+k4)/6; - x2:=x1+ODEstep; - y2:=y1+ODEstep*kk;} - \ODEline{z1}{z2} - \mfsrc{ - if ((y2>yneg) and (y2<ypos)): x1:=x2; y1:=y2 fi; - endfor - }} + \begin{connect} + \mfsrc{x1:=#1;y1:=#2; + for i=1 upto ODEstepcount: + k1:=ODErhs(x1,y1); + x3:=x1+(ODEstep/2); + y3:=y1+k1*(ODEstep/2); + k2:=ODErhs(x3,y3); + y4:=y1+k2*(ODEstep/2); + k3:=ODErhs(x3,y4); + y5:=y1+k3*(ODEstep/2); + k4:=ODErhs(x3,y5); + kk:=(k1+2*k2+2*k3+k4)/6; + x2:=x1+ODEstep; + y2:=y1+ODEstep*kk;} + \ODEline{z1}{z2} + \mfsrc{ + if ((y2>yneg) and (y2<ypos)): x1:=x2; y1:=y2 fi; + endfor + } + \end{connect} +} \def\ODEarrow#1#2{ \mfsrc{x1:=#1; y1:=#2; x3:=x1+(ODEarrowlength)/((xscale)++(ODErhs(#1,#2)*yscale)); @@ -135,15 +144,18 @@ \def\ASdefineequations#1#2{\fdef{ASf}{x,y}{#1}\fdef{ASg}{x,y}{#2}} \def\AStrajectory#1#2{ - \mfsrc{x1:=#1;y1:=#2; - for i=1 upto ODEstepcount: - x2:=x1+ODEstep*ASf(x1,y1); - y2:=y1+ODEstep*ASg(x1,y1);} - \ODEline{z1}{z2} - \mfsrc{ - if ((y2>yneg) and (y2<ypos)): x1:=x2; y1:=y2 fi; - endfor - }} + \begin{connect} + \mfsrc{x1:=#1;y1:=#2; + for i=1 upto ODEstepcount: + x2:=x1+ODEstep*ASf(x1,y1); + y2:=y1+ODEstep*ASg(x1,y1);} + \ODEline{z1}{z2} + \mfsrc{ + if ((y2>yneg) and (y2<ypos)): x1:=x2; y1:=y2 fi; + endfor + } + \end{connect} +} \def\ASarrow#1#2{ \mfsrc{x1:=#1; y1:=#2; x3:=x1+(ODEarrowlength*ASf(#1,#2))/((ASf(#1,#2)*xscale)++(ASg(#1,#2)*yscale )); @@ -164,27 +176,30 @@ \else \AStrajectoryRKF{#1}{#2}\relax\let\next\AS@cycle@IC\fi\next} \def\AStrajectoryRKF#1#2{ - \mfsrc{x1:=#1;y1:=#2; - TIMEsteps:=abs(TIMEend/TIMEstep); - TIME:=0; - for i=1 upto TIMEsteps: - k1:=ASf(x1,y1); - l1:=ASg(x1,y1); - k2:=ASf(x1+(TIMEstep*k1/2),y1+(TIMEstep*l1/2)); - l2:=ASg(x1+(TIMEstep*k1/2),y1+(TIMEstep*l1/2)); - k3:=ASf(x1+(TIMEstep*k2/2),y1+(TIMEstep*l2/2)); - l3:=ASg(x1+(TIMEstep*k2/2),y1+(TIMEstep*l2/2)); - k4:=ASf(x1+(TIMEstep*k3),y1+(TIMEstep*l3)); - l4:=ASg(x1+(TIMEstep*k3),y1+(TIMEstep*l3)); - k5:=((k1)/6)+((k2)/3)+((k3)/3)+((k4)/6); - l5:=(l1/6)+(l2/3)+(l3/3)+(l4/6); - x2:=x1+(TIMEstep*k5); - y2:=y1+(TIMEstep*l5);} - \ODEline{z1}{z2} - \mfsrc{ - if ((y2>yneg) and (y2<ypos) and (x2<xpos) and (x2>xneg)): x1:=x2; y1:=y2 fi; - endfor - }} + \begin{connect} + \mfsrc{x1:=#1;y1:=#2; + TIMEsteps:=abs(TIMEend/TIMEstep); + TIME:=0; + for i=1 upto TIMEsteps: + k1:=ASf(x1,y1); + l1:=ASg(x1,y1); + k2:=ASf(x1+(TIMEstep*k1/2),y1+(TIMEstep*l1/2)); + l2:=ASg(x1+(TIMEstep*k1/2),y1+(TIMEstep*l1/2)); + k3:=ASf(x1+(TIMEstep*k2/2),y1+(TIMEstep*l2/2)); + l3:=ASg(x1+(TIMEstep*k2/2),y1+(TIMEstep*l2/2)); + k4:=ASf(x1+(TIMEstep*k3),y1+(TIMEstep*l3)); + l4:=ASg(x1+(TIMEstep*k3),y1+(TIMEstep*l3)); + k5:=((k1)/6)+((k2)/3)+((k3)/3)+((k4)/6); + l5:=(l1/6)+(l2/3)+(l3/3)+(l4/6); + x2:=x1+(TIMEstep*k5); + y2:=y1+(TIMEstep*l5);} + \ODEline{z1}{z2} + \mfsrc{ + if ((y2>yneg) and (y2<ypos) and (x2<xpos) and (x2>xneg)): x1:=x2; y1:=y2 fi; + endfor + } + \end{connect} +} \catcode`\@12\relax \endinput diff --git a/Master/texmf-dist/source/latex/mfpic4ode/mfpic4ode.dtx b/Master/texmf-dist/source/latex/mfpic4ode/mfpic4ode.dtx index 0f712022f44..82b78640c93 100644 --- a/Master/texmf-dist/source/latex/mfpic4ode/mfpic4ode.dtx +++ b/Master/texmf-dist/source/latex/mfpic4ode/mfpic4ode.dtx @@ -22,7 +22,7 @@ %<sty>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<sty>\ProvidesPackage{mfpic4ode} %<*sty> - [2008/01/03 v0.2 mfpic4ode.dtx file] + [2009/04/15 v0.3 mfpic4ode.dtx file] %</sty> % %<*driver> @@ -38,7 +38,7 @@ %</driver> % \fi % -% \CheckSum{175} +% \CheckSum{185} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -58,13 +58,14 @@ % % % \changes{v0.2}{2008/01/03}{First public version} +% \changes{v0.3}{2009/04/15}{Added connect environment to paths} % % \GetFileInfo{mfpic4ode.dtx} % % \DoNotIndex{\newcommand,\newenvironment} % -% \def\fileversion{0.2} -% \def\filedate{2008/01/03} +% \def\fileversion{0.3} +% \def\filedate{2009/04/15} % % \title{The \textsf{mfpic4ode} package\thanks{This document % corresponds to \textsf{mfpic4ode}~\fileversion, dated \filedate.}} @@ -164,13 +165,15 @@ % \end{verbatim} % The integral curve is drawn from short linear parts using |\ODEline| % command which expands to |\lines| command from |mfpic| package by -% default. A simple test is used to keep the arithmetics in reasonable -% bounds: if after the step the curve leaves the horizontal strip -% between |yneg| and |ypos| variables, then the evaluation is stopped -% (in fact, in this case we do not change the independent variable and -% we do the remaining steps with the same last point). Recall that -% |yneg| and |ypos| variables are set when you call |mfpicture| -% environment. If you call the environment as follows +% default. These linear parts are connected in connect environment and +% this allows to use prefixes like |\dotted| or |\dashed| to the +% trajectories. A simple test is used to keep the arithmetics in +% reasonable bounds: if after the step the curve leaves the horizontal +% strip between |yneg| and |ypos| variables, then the evaluation is +% stopped (in fact, in this case we do not change the independent +% variable and we do the remaining steps with the same last point). +% Recall that |yneg| and |ypos| variables are set when you call +% |mfpicture| environment. If you call the environment as follows % \begin{verbatim} % \begin{mfpic}[5][3]{-0.1}{1.5}{-0.1}{0.5} % ........... @@ -247,51 +250,60 @@ %%% ODEstep and the number of steps is ODEstepcount. The points are %%% stored in metapost variables x1,y1. \def\trajectory#1#2{ - \mfsrc{x1:=#1;y1:=#2; - for i=1 upto ODEstepcount: - x2:=x1+ODEstep; - y2:=y1+ODEstep*ODErhs(x1,y1);} - \ODEline{z1}{z2} - \mfsrc{ - if ((y2>yneg) and (y2<ypos)): x1:=x2; y1:=y2 fi; - endfor - }} + \begin{connect} + \mfsrc{x1:=#1;y1:=#2; + for i=1 upto ODEstepcount: + x2:=x1+ODEstep; + y2:=y1+ODEstep*ODErhs(x1,y1);} + \ODEline{z1}{z2} + \mfsrc{ + if ((y2>yneg) and (y2<ypos)): x1:=x2; y1:=y2 fi; + endfor + } + \end{connect} +} %%% Integral curve using Runge--Kutta method. \def\trajectoryRK#1#2{ - \mfsrc{x1:=#1;y1:=#2; - for i=1 upto ODEstepcount: - k1:=ODErhs(x1,y1); - x3:=x1+(ODEstep/2); - y3:=y1+k1*(ODEstep/2); - k2:=ODErhs(x3,y3); - x2:=x1+ODEstep; - y2:=y1+ODEstep*k2;} - \ODEline{z1}{z2} - \mfsrc{ - if ((y2>yneg) and (y2<ypos)): x1:=x2; y1:=y2 fi; - endfor - }} + \begin{connect} + \mfsrc{x1:=#1;y1:=#2; + for i=1 upto ODEstepcount: + k1:=ODErhs(x1,y1); + x3:=x1+(ODEstep/2); + y3:=y1+k1*(ODEstep/2); + k2:=ODErhs(x3,y3); + x2:=x1+ODEstep; + y2:=y1+ODEstep*k2;} + \ODEline{z1}{z2} + \mfsrc{ + if ((y2>yneg) and (y2<ypos)): x1:=x2; y1:=y2 fi; + endfor + } + \end{connect} +} %%% Integral curve using fourth order Runge--Kutta method. \def\trajectoryRKF#1#2{ - \mfsrc{x1:=#1;y1:=#2; - for i=1 upto ODEstepcount: - k1:=ODErhs(x1,y1); - x3:=x1+(ODEstep/2); - y3:=y1+k1*(ODEstep/2); - k2:=ODErhs(x3,y3); - y4:=y1+k2*(ODEstep/2); - k3:=ODErhs(x3,y4); - y5:=y1+k3*(ODEstep/2); - k4:=ODErhs(x3,y5); - kk:=(k1+2*k2+2*k3+k4)/6; - x2:=x1+ODEstep; - y2:=y1+ODEstep*kk;} - \ODEline{z1}{z2} - \mfsrc{ - if ((y2>yneg) and (y2<ypos)): x1:=x2; y1:=y2 fi; - endfor - }} + \begin{connect} + \mfsrc{x1:=#1;y1:=#2; + for i=1 upto ODEstepcount: + k1:=ODErhs(x1,y1); + x3:=x1+(ODEstep/2); + y3:=y1+k1*(ODEstep/2); + k2:=ODErhs(x3,y3); + y4:=y1+k2*(ODEstep/2); + k3:=ODErhs(x3,y4); + y5:=y1+k3*(ODEstep/2); + k4:=ODErhs(x3,y5); + kk:=(k1+2*k2+2*k3+k4)/6; + x2:=x1+ODEstep; + y2:=y1+ODEstep*kk;} + \ODEline{z1}{z2} + \mfsrc{ + if ((y2>yneg) and (y2<ypos)): x1:=x2; y1:=y2 fi; + endfor + } + \end{connect} +} \def\ODEarrow#1#2{ \mfsrc{x1:=#1; y1:=#2; x3:=x1+(ODEarrowlength)/((xscale)++(ODErhs(#1,#2)*yscale)); @@ -344,15 +356,18 @@ \def\ASdefineequations#1#2{\fdef{ASf}{x,y}{#1}\fdef{ASg}{x,y}{#2}} \def\AStrajectory#1#2{ - \mfsrc{x1:=#1;y1:=#2; - for i=1 upto ODEstepcount: - x2:=x1+ODEstep*ASf(x1,y1); - y2:=y1+ODEstep*ASg(x1,y1);} - \ODEline{z1}{z2} - \mfsrc{ - if ((y2>yneg) and (y2<ypos)): x1:=x2; y1:=y2 fi; - endfor - }} + \begin{connect} + \mfsrc{x1:=#1;y1:=#2; + for i=1 upto ODEstepcount: + x2:=x1+ODEstep*ASf(x1,y1); + y2:=y1+ODEstep*ASg(x1,y1);} + \ODEline{z1}{z2} + \mfsrc{ + if ((y2>yneg) and (y2<ypos)): x1:=x2; y1:=y2 fi; + endfor + } + \end{connect} +} \def\ASarrow#1#2{ \mfsrc{x1:=#1; y1:=#2; x3:=x1+(ODEarrowlength*ASf(#1,#2))/((ASf(#1,#2)*xscale)++(ASg(#1,#2)*yscale )); @@ -373,27 +388,30 @@ \else \AStrajectoryRKF{#1}{#2}\relax\let\next\AS@cycle@IC\fi\next} \def\AStrajectoryRKF#1#2{ - \mfsrc{x1:=#1;y1:=#2; - TIMEsteps:=abs(TIMEend/TIMEstep); - TIME:=0; - for i=1 upto TIMEsteps: - k1:=ASf(x1,y1); - l1:=ASg(x1,y1); - k2:=ASf(x1+(TIMEstep*k1/2),y1+(TIMEstep*l1/2)); - l2:=ASg(x1+(TIMEstep*k1/2),y1+(TIMEstep*l1/2)); - k3:=ASf(x1+(TIMEstep*k2/2),y1+(TIMEstep*l2/2)); - l3:=ASg(x1+(TIMEstep*k2/2),y1+(TIMEstep*l2/2)); - k4:=ASf(x1+(TIMEstep*k3),y1+(TIMEstep*l3)); - l4:=ASg(x1+(TIMEstep*k3),y1+(TIMEstep*l3)); - k5:=((k1)/6)+((k2)/3)+((k3)/3)+((k4)/6); - l5:=(l1/6)+(l2/3)+(l3/3)+(l4/6); - x2:=x1+(TIMEstep*k5); - y2:=y1+(TIMEstep*l5);} - \ODEline{z1}{z2} - \mfsrc{ - if ((y2>yneg) and (y2<ypos) and (x2<xpos) and (x2>xneg)): x1:=x2; y1:=y2 fi; - endfor - }} + \begin{connect} + \mfsrc{x1:=#1;y1:=#2; + TIMEsteps:=abs(TIMEend/TIMEstep); + TIME:=0; + for i=1 upto TIMEsteps: + k1:=ASf(x1,y1); + l1:=ASg(x1,y1); + k2:=ASf(x1+(TIMEstep*k1/2),y1+(TIMEstep*l1/2)); + l2:=ASg(x1+(TIMEstep*k1/2),y1+(TIMEstep*l1/2)); + k3:=ASf(x1+(TIMEstep*k2/2),y1+(TIMEstep*l2/2)); + l3:=ASg(x1+(TIMEstep*k2/2),y1+(TIMEstep*l2/2)); + k4:=ASf(x1+(TIMEstep*k3),y1+(TIMEstep*l3)); + l4:=ASg(x1+(TIMEstep*k3),y1+(TIMEstep*l3)); + k5:=((k1)/6)+((k2)/3)+((k3)/3)+((k4)/6); + l5:=(l1/6)+(l2/3)+(l3/3)+(l4/6); + x2:=x1+(TIMEstep*k5); + y2:=y1+(TIMEstep*l5);} + \ODEline{z1}{z2} + \mfsrc{ + if ((y2>yneg) and (y2<ypos) and (x2<xpos) and (x2>xneg)): x1:=x2; y1:=y2 fi; + endfor + } + \end{connect} +} \catcode`\@12\relax %</tex> diff --git a/Master/texmf-dist/tex/latex/mfpic4ode/mfpic4ode.sty b/Master/texmf-dist/tex/latex/mfpic4ode/mfpic4ode.sty index e8a9476e6df..9467cf0ded8 100644 --- a/Master/texmf-dist/tex/latex/mfpic4ode/mfpic4ode.sty +++ b/Master/texmf-dist/tex/latex/mfpic4ode/mfpic4ode.sty @@ -22,7 +22,7 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{mfpic4ode} - [2008/01/03 v0.2 mfpic4ode.dtx file] + [2009/04/15 v0.3 mfpic4ode.dtx file] \input mfpic4ode.tex\relax \endinput %% |