Handling constraints in NDSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg32002] Handling constraints in NDSolve
- From: "Philip M. Howe" <pmhowe at lanl.gov>
- Date: Mon, 17 Dec 2001 06:01:33 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Dear Folks,
I am not sure how to use NDSolve with an equation set that contains
constraints. A very simple example is shown below. There are two
unknowns (x and y) which are functions of t. I have two equations and
impose two initial conditions. Seems like it should work, but I am
probably doing something foolish. If I remove the constraints, the
system works fine. Any advice?
Clear[x, y, t];
T = 1200;
Eact = 149000;
kzero = 5.468*10^6;
rho0 = 1.834;
Rgas = 8.314;
L = 1;
k1 = kzero* Exp[-Eact/(Rgas*T)];
s = NDSolve[
{ x'[t] == x[t](L - x[t])*(1 - y[t]),
y'[t] == -k1*y[t] /; t < x[t]/x'[t],
y'[t] == 0 /; t =84 x[t]/x'[t],
x[0] == 0.001,
y[0] == 1},
{y[t], x[t]}, {t, 0, 100.}
];
y1a = y[t] /. s[[1]][[1]];
xa = x[t] /. s[[1]][[2]]
Plot[y1a, {t, 0, 20}, PlotRange -> All];
Plot[xa, {t, 0.001, 20}, PlotRange -> All];
Thanks for any help you can give me.
Phil
--
Philip M. Howe
Program Manager, Stockpile Surety
Los Alamos National Laboratory
(505) 665-5332
(505) 667-9498
Fax: 505-665-5249
email pmhowe at lanl.gov
Mail Stop F606