Message Boards Message Boards

0
|
4510 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Input isn't a differential equation error

I have been working up a pretty simple code and I keep running up against an error saying input isn't a differential equation. Any help would be much appreciated.

Clear["Global'*"];
ka = .2; kd = .02; km = 150; ns = 10; sens = 3; ro2 = 50; a = .2;
odeca = ka nut[t] cella[t] - 
   kd (1 - (1 + (nut[t]/ns)^(sens))) cella[t];
odecd = kd (1 - (1 + (nut[t]/ns)^(sens))) cella[t];
odeo2 = ro2 (1200 - o2[t]) - km cella[t];
oden = -ka nut[t] cella[t];
vars = {cella[t], celld[t], o2[t], nut[t]};
solution = 
  NDSolve[{cella'[t] == odeca, celld'[t] == odecd, o2'[t] == odeo2, 
    nut'[t] == oden, cella[0] == 10, celld[0] == 1, o2[0] == 1200, 
    n[0] == 200}, vars, {t, 0, 31}];
vars;
vars1 = vars /. solution /. t -> 31; vars2 = Flatten[vars1]
POSTED BY: Josh Wofford
3 Replies

Thanks, can't believe it was only a typo but thanks for loaning me a second pair of eyes to look at it.

POSTED BY: Josh Wofford
In[25]:= Clear["Global'*"];
ka = .2; kd = .02; km = 150; ns = 10; sens = 3; ro2 = 50; a = .2;
solution = NDSolve[{
   cella'[t] == 
    ka nut[t] cella[t] - kd (1 - (1 + (nut[t]/ns)^(sens))) cella[t],
   celld'[t] == kd (1 - (1 + (nut[t]/ns)^(sens))) cella[t],
   o2'[t] == ro2 (1200 - o2[t]) - km cella[t],
   nut'[t] == -ka nut[t] cella[t],
   cella[0] == 10, celld[0] == 1, o2[0] == 1200, nut[0] == 200},
  {cella[t], celld[t], o2[t], nut[t]}, {t, 0, 31}]

Out[27]= {{cella[t] -> InterpolatingFunction[{{0., 31.}}, <>][t], 
  celld[t] -> InterpolatingFunction[{{0., 31.}}, <>][t], 
  o2[t] -> InterpolatingFunction[{{0., 31.}}, <>][t], 
  nut[t] -> InterpolatingFunction[{{0., 31.}}, <>][t]}}

I think there were two problems. Your initial condition for nut was give as n[0]. Also your intermediate variables, odeca, etc. were not explicit functions of time and problem variables.

POSTED BY: Frank Kampas

If you look at your code, the call to NDSolve you give is:

NDSolve[{
  Derivative[1][cella][t] == 0.2 cella[t] nut[t] + 0.00002 cella[t] nut[t]^3, 
  Derivative[1][celld][t] == -0.00002 cella[t] nut[t]^3, 
  Derivative[1][o2][t] == -150 cella[t] + 50 (1200 - o2[t]), 
  Derivative[1][nut][t] == -0.2 cella[t] nut[t], 
cella[0] == 10, celld[0] == 1, o2[0] == 1200, n[0] == 200}, 
{cella[t], celld[t], o2[t], nut[t]}, {t, 0, 31}]

The first argument to NDSolve is a list of 8 equations. I would take a look at every equation individually and ask myself whether they make sense. The first four are differential equations. The last four are initial conditions. The very last equation you give is incorrect. Correct the very last equation and NDSolve should evaluate.

POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract