Re: Problem with discontinuity in NDSolve[]
- To: mathgroup at smc.vnet.net
- Subject: [mg4429] Re: [mg4301] Problem with discontinuity in NDSolve[]
- From: Andrei Constantinescu <constant at xanthe.polytechnique.fr>
- Date: Mon, 22 Jul 1996 01:19:41 -0400
- Sender: owner-wri-mathgroup at wolfram.com
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 at athena.polytechnique.fr LMS Ecole Polytechnique tel: (33)-1-69.33.33.30 91128 PALAISEAU cedex - FRANCE fax: (33)-1-69.33.30.26 ==== [MESSAGE SEPARATOR] ====