Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: Re: [mg4301] Problem with discontinuity in NDSolve[]
Replies: 0

 Andrei Constantinescu Posts: 1 Registered: 12/11/04
Re: [mg4301] Problem with discontinuity in NDSolve[]
Posted: Jul 17, 1996 1:38 AM

Dear Axel,

there is a fundamental math problem with your system.

If you compute [e:

NDSolve[{y'[t] == 10 - y[t] * If[t-15 <= 0, 0, 1],
y[0] == 0}, y, {t,0,20}]

the solution is simple because the system has two behaviours
one for t < 0 and another one for t > 0. So everything is nice.

But if you write:

NDSolve[{y'[t] == 10 - y[t] * If[y[t]-15 <= 0, 0, 1],
y[0] == 0}, y, {t,0,20}]

then the system has also two behavoiurs one for y < 0 and
another one for y > 15 .

Unfortunately each time as the system reaches y = 15, its
switching to the second exponential behaviour, but then the solutions
also decreases so you arrive again at y < 0, and you switch again,

... which gives a neverendind story, and of course the computation
never converges !

In order to obtain a behaviour until y reaches 15 and another one
after (even if y < 15 again !), you have to introduce an internal
parameter, governing the swich:
alpha = 0 until y = 15
alpha = 1 if y was already been 15
... which means another equation to your problem of the sort:

alpha == If[ alpha == 1 || y == 15 , 1 , 0 ]

a + andrei

______________________________________________________________________
Andrei Constantinescu constant@athena.polytechnique.fr

LMS Ecole Polytechnique tel: (33)-1-69.33.33.30
91128 PALAISEAU cedex - FRANCE fax: (33)-1-69.33.30.26