MathGroup Archive 1997

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

Search the Archive

RE: Re[2]: StoppingTest does not work ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg9795] RE: Re[2]: [mg9769] StoppingTest does not work ?
  • From: Jean-Marie THOMAS <jmthomas at cybercable.tm.fr>
  • Date: Fri, 28 Nov 1997 05:35:09 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

The code for my example can be accessed on my ftp site under the name 
"[mg9769] StoppingTest does not work ?" HostName: 195.132.8.82
userID "mathGroup"
password "mathGroup".

This example is run under Mathematica 3 on a Intel based NT workstation.

If I enter the following line (f1 refers to the solution obtained when 
solving for y)
f1 at f1[[1,1,2]]
I get:
1.49187
which I understand as the maximum value reached by y before the test
stops  solution computation.

Maybe I do not understand exactly want you want. There is no
documentation  in the Mathematica Book on what exactly this
StoppingTest option is  supposed to do, but in the code I propose, the
test does something in a  coherent manner.
Other useful tests can be implemented for NDSolve, using TimeConstrained
or  MemoryConstrained, in case you want to get out of an evaluation
that takes  too much time or uses too much memory ressources.


-----Message d'origine-----
De:	Gilles BARBIER [SMTP:Gilles.Barbier at der.edfgdf.fr] Date:	mardi 25
novembre 1997 15:18
A:	jmthomas at cybercable.tm.fr; mathgroup at wolfram.com Objet:	Re[2]:
[mg9769] StoppingTest does not work ?


     In your case, Mathematica stops for x=.4 and y=1.5 (approximately)
     that is still not what I want.

     Moreover :
     sol=NDSolve[{y'[t]==1,y[0]==0},y[t],{t,0,2},StoppingTest->y[t]>1.4]
     does not stop at all.

     It seems that StoppingTest works more or less depending of the
     equation to solve...

     Gilles.


____________________________ Separateur Reponse 
________________________________
Objet : RE: [mg9769] StoppingTest does not work ? Auteur : 
jmthomas at cybercable.tm.fr a Hub Date :    25/11/1997 14:47


Your StoppingTest function involves y[t] while you are solving for y.

Please note the function is slightly different from yours:

sol=NDSolve[{y'[t]==y[t],y[0]==1},y,{t,0,2},StoppingTest->y>1.4]
f1=y/.sol[[1,1]]
Plot[f1[t],Evaluate at Flatten[{t,First at First@f1}]]

If you solve for y[t], then your test function is correct: Clear at f1
sol=NDSolve[{y'[t]==y[t],y[0]==1},y[t],{t,0,2},StoppingTest->y[t]>1.4]
f1[t_]=y[t]/.sol[[1,1]]
Plot[f1[t],{t,0,0.5}]

----------------------------------------------- Jean-Marie THOMAS
Conseil et Audit en Ingenierie de Calcul jmthomas at cybercable.tm.fr
+33 (0)3 88 32 93 64
www.cybercable.tm.fr/~jmthomas
=======================

-----Message d'origine-----
De: Gilles BARBIER [SMTP:Gilles.Barbier at der.edfgdf.fr] A:
mathgroup at smc.vnet.net
Objet: [mg9769] StoppingTest does not work ?


     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.


  • Prev by Date: Re: Trivial integral freezes 3.0
  • Next by Date: Re: Intersecting volumes
  • Previous by thread: Re[2]: StoppingTest does not work ?
  • Next by thread: Re: StoppingTest does not work ?