Re: StoppingTest does not work ?
- To: mathgroup at smc.vnet.net
- Subject: [mg9834] Re: [mg9769] StoppingTest does not work ?
- From: Wouter Meeussen <vdmcc at vandemoortele.be>
- Date: Fri, 28 Nov 1997 05:35:46 -0500
- Sender: owner-wri-mathgroup at wolfram.com
Gilles,
a dirty trick:
make StoppingTest a delayed rule (:> not -> ), including a print
statement, and then you can watch
the mechanism at work !
several values of t are generated in the interval {t,tmin,tmax}. Each
time, y[t] is evaluated and tested against the StoppingTest. If that
returns false BEFORE the end of the t-interval (tmax) was reached, then
the last value for t is taken as the the endpoint of the interval over
wich the InterpolatingFunction is defined,
EVEN IF the y[t] corresponding to that t is WAY ABOVE the stoppingtest
limit.
Consequence:
I suppose StoppingTest can not be used to prevent evaluation over a
illegal domain.
In[3]:=NDSolve[{y'[t]==1,y[0]==0},{y},{t,0,2},StoppingTest:>(Print[y[t]];y[t
]>1)]
0.
0.000894427
0.00178885
2.
Out[3]={{y -> InterpolatingFunction[{{0., 2.}}, <>]}}
In[4]:=NDSolve[{y'[t]==1,y[0]==0},{y},{t,0,1000},StoppingTest:>(Print[y[t]];
y[t]>1)]
0.
0.001
0.002
10.002
Out[4]={{y -> InterpolatingFunction[{{0., 10.002}}, <>]}}
I hope this helps,
wouter.
At 12:07 25.11.97 -0500, Gilles BARBIER wrote:
>
> Anyone could tell me why :
>
> NDSolve[{y'[t]==1,y[0]==0},{y},{t,0,2},StoppingTest->(y[t]>1)]
>
> does not stop for t=1 (it does not stop at all, in fact).
> Of course, my problem is more complicated, but in all case
> stoppingTest seems to stop when it wants...
>
> Thanks for quick help, Please !!!
>
> Gilles.
>
>
NV Vandemoortele Coordination Center Oils & Fats Applied Research
Prins Albertlaan 79
Postbus 40
B-8870 Izegem (Belgium)
Tel: +/32/51/33 21 11
Fax: +/32/51/33 21 75
vdmcc at vandemoortele.be