Re: right StoppingTest
- To: mathgroup at smc.vnet.net
- Subject: [mg31734] Re: right StoppingTest
- From: bghiggins at ucdavis.edu (Brian Higgins)
- Date: Thu, 29 Nov 2001 00:14:04 -0500 (EST)
- References: <9tvgln$fql$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Borut,
Here is a simple example that should help you get going:
eqns = {y'[t] == 4y[t], y[0] == 1}
sol = NDSolve[eqns, y[t], {t, 0, 10},
StoppingTest :> If[y[t] > 200, lastT = t; True, False]]
Plot[y[t] /. sol, {t, 0, lastT}]
Cheers,
Brian
"Borut L" <borut at email.si> wrote in message news:<9tvgln$fql$1 at smc.vnet.net>...
> Hello,
>
> I am solving a coupled system
>
> o'[t] == a d[t] o[t] - b o[t]
> d'[t] == -a d[t] o[t]
> i'[t] == b o[t]
>
> with NDSolve for o, d and i
>
> There is a maximum for o[t] and I would like to stop the integration
> when it is reached and be given the value of o and time t when this happens.
>
> I can't make the option StoppingTest to work it out properly.
>
> Please suggest any help.
>
>
> Thanks,
>
> Borut