inequality as constraints on NDSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg106196] inequality as constraints on NDSolve
- From: "Stefano Pasetto" <spasetto at ari.uni-heidelberg.de>
- Date: Tue, 5 Jan 2010 01:42:24 -0500 (EST)
Dear Mathematica experts: is there a possibility to implement a constraint in NDSolve? Suppose I want to solve NDSolve[{x'[t] == -y[t] - x[t]^2, y'[t] == 2 x[t] - y[t]^3, x[0] == y[0] == 1}, {x, y}, {t, 20}] But I want that the solutions satisfied the inequality x[t]>0 for every t (because it represent a physical quantity that has no meaning to be negative), i.e., and when it becomes =0 it has to stay zero. I've tried something like x[t_]:=If[x[t]>0,x[t],0] in the definition of x or y but it does not make sense. Somehow, I'd need to change the solution of the system when the solution itself become negative. ThankX for the help, :-) Best regards Stefano Pasetto