Re: right StoppingTest
- To: mathgroup at smc.vnet.net
- Subject: [mg31735] Re: right StoppingTest
- From: "Borut L" <borut at email.si>
- Date: Thu, 29 Nov 2001 00:14:06 -0500 (EST)
- References: <9tvgln$fql$1@smc.vnet.net> <9u20bm$ipa$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, I recognized just later on I hadn't given the initial conditions. I forgot to mention that the equations describe a real physical system of a disease diffusing among population sorted into three classes: the immune i, the sick o and the one-who-are-all-right-but-can-get-sick d. It follows that d(o+i+d)/d(time) = 0 I would like to ask why :> is used in StoppingTest, instead of an ordinary ->? Thank you, Borut "Orestis Vantzos" <atelesforos at hotmail.com> wrote in message news:9u20bm$ipa$1 at smc.vnet.net... > The following code will return a list of the form: > {{omax,tmax},{o[t]->-InterpolatingFunction-,...}} > where omax is the maximum o and tmax the corresponding t: > > Module[{oldO = -\[Infinity], oldT, sol}, > sol = NDSolve[equs, {o[t], d[t], i[t]}, {t, 0, 10}, > StoppingTest :> (If[o < oldO, True, oldO = o; oldT = t; > False])]; > {{oldO, oldT}, sol}] > > where equs is your ODE system with NUMERIC values for a and b, plus > proper initial conditions (of the form o[0]==..,d[0]==..,i[0]==..). > Orestis >