[pstricks] concatenate \psplotDiffEqn, continue integration of ODEs

Alexander Grahn A.Grahn at fzd.de
Thu Jun 4 14:45:18 CEST 2009


Herbert,

On Wed, Jun 03, 2009 at 09:22:52AM +0200, Herbert Voss wrote:
>Alexander Grahn schrieb:
>> On Tue, Jun 02, 2009 at 07:28:58PM +0200, Dominique RODRIGUEZ wrote:
>>> Bonjour,
>>>
>>>>  is it possible to continue the integration of a set of differential
>>>>  equations by repated calls to \psplotDiffEqn? That is, to use the last
>>>>  solution vector of a \psplotDiffEqn call as the initial conditions for
>>>>  the next call?
>>> Currently, it is not possible, but this is a good suggestion !
>>> I put it in the TODO list.
>
>until then you can use the file export:
>pstricks-add knows
>
>\define at key[psset]{pstricks-add}{filename}{\def\psk at filename{#1}}
>\define at boolkey[psset]{pstricks-add}[Pst@]{saveData}[true]{}
>\psset[pstricks-add]{saveData=false,filename=PSTdata}
>
>You can write the values into an external file and use
>the values for a next run of \pstDiffEqn.

Thanks for your replay. Nevertheless, it puzzles me. Do you mean I have to say

\psset[pstricks-add]{saveData=false,filename=PSTdata}

somewhere before \pstDiffEqn? And what else do I have to do?

Let's take the 'spiral of cornu' example from the pstricks-add manual
and break the original integration interval t=[0,1] into two sub-intervals
t=[0,0.5], t=[0.5,1] and call \pstDiffEqn twice:

\documentclass{article}
\usepackage{pstricks-add}
\psset[pstricks-add]{saveData=false,filename=PSTdata}

\begin{document}
\psset{unit=8}
 \begin{pspicture}(1,1)\psgrid[subgriddiv=5]
 \psplotDiffEqn[ %first call
   whichabs=0,whichord=1,linecolor=red,method=rk4,
   algebraic=true,
   plotpoints=25,showpoints=true
 ]{0}{0.5}{0 0}{
   cos(Pi*x^2/2)|sin(Pi*x^2/2)
 }%
 \psplotDiffEqn[ %continue integration
   whichabs=0,whichord=1,linecolor=blue,method=rk4,
   algebraic=true,
   plotpoints=25,showpoints=true
 ]{0.5}{1}{? ?}{
   cos(Pi*x^2/2)|sin(Pi*x^2/2)
 }
\end{document}

In order to continue the integration I have to fill somehow the 3rd
argument {? ?} (initial conditions) of the second \psplotDiffEqn call
with the solution vector of the first call at t=0.5.

Could you please show me how to do this using a data file?

Thanks!
Alexander


More information about the PSTricks mailing list