MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Modification of Variable in NDSolve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg107916] Re: [mg107886] Modification of Variable in NDSolve
  • From: Patrick Scheibe <pscheibe at trm.uni-leipzig.de>
  • Date: Tue, 2 Mar 2010 07:55:53 -0500 (EST)
  • References: <201003020835.DAA03933@smc.vnet.net>

Hi,

I didn't read you post carefully but it seems you want to catch an  event during
the run of NDSolve and maybe this helps you out.

http://reference.wolfram.com/mathematica/tutorial/NDSolveEventLocator.html

Cheers
Patrick


Am Mar 2, 2010 um 9:35 AM schrieb Shawn Garbett:

> I need to modify a variable while a system of ODE's are being solved.
> I've simplified the problem to the following:
>
> dA = B[t];
> dB = (1 - A[t]^2) B[t] - A[t];
> dF = B[t] + 0.2;
>
> Module[{count = 0, last = 0.},
> sol = NDSolve[{A'[t] == dA, B'[t] == dB, F'[t] == dF, A[0] == 1,
>    B[0] == 1, F[0] == 1}, {A, B, F}, {t, 0, 100},
>   StepMonitor :> If[last <= 5 <= F[t] && last < F[t],
>     count++; last = F[t],
>     last = F[t]]
>   ]; count]
>
> This does a threshold crossing of 5 for the variable F from below. The
> count that results is correct, but one more thing is needed. This
> shows the graphs
>
> disp = Plot[#[t] /. sol, {t, 0, 100}, PlotRange -> All] &;
> GraphicsGrid[Map[disp, {{A, B}, {F}}, {2}]]
>
> What I need is for F to be set to half it's value at each threshold
> crossing from below. I've been trying introducing another variable,
> but so far nothing I've tried seems to work.
>



  • Prev by Date: Re: Annoying error in Hypergeometric2F1
  • Next by Date: Re: Efficient representation of many different primitives
  • Previous by thread: Modification of Variable in NDSolve
  • Next by thread: Re: Modification of Variable in NDSolve