# NDSolve error---equations expected [closed]

I keep getting an error trying to used NDSolve for three coupled equations. It works in another programming language, but I am having trouble apparently writing it correctly in Mathematica. The error message says that equations are expected. I really don't understand why this is written incorrectly.

Nn = 100;
R = 50;

Cc = .00008;
K = 0.5;
VP = 1.4;
VS = 0.33;
VMAX = 1.0;
a = 20;

TW = 40.0;
TP = 200.0;
DT = 1.0;
TS = 5.0;
TU = 10.0;
k1 = 1.0;
k2 = 10.0;
k3 = 1.0;
P1 = 0.001;
P3 = 0.001;
nw = a*x[t]/(1.0 - x[t]);
np = a*(1.0 - x[t])/x[t]*(VS/VMAX);
M = 50;

s =
NDSolve[{
x'[t] == y[t]/(TW + (a*x[t]/(1.0 - x[t]))*DT) - z[t]/(TP + TU +
np*DT)*VP/VMAX - Cc*x[t]*(Nn/M),
y'[t] == P1*(1.0 - x[t]) -
y[t]*(1.0 - k1*E (((nw/k2)^k3)))/(TW + nw*DT),
z'[t] == P3*x[t] -
z[t]*(1.0 - k1*E ((((a*(1.0 - x[t])/x[t]*(VS/VMAX))/k2)^k3)))/(TP + TU + np*DT),
x[0] == y[0] == z[0] == .1},
{x[t], y[t], z[t]}, {t, 10}];

-

## closed as off-topic by m_goldberg, Artes, Sjoerd C. de Vries, Kuba, Michael E2Sep 20 '13 at 10:44

• The question does not concern the technical computing software Mathematica by Wolfram Research. Please see the help center to find out about the topics that can be asked here.
If this question can be reworded to fit the rules in the help center, please edit the question.

Use the button that looks like {} to include code. Also, do post the code for the variables defined above the equations. By the way, there should be only two =, not three after z[0]. –  Hector Sep 17 '13 at 21:52
I get a solutions with no messages at all from Mathematica when I evaluate your code as it is now posted. –  m_goldberg Sep 19 '13 at 4:04
This question appears to be off-topic because the problem the user claims to be experiencing can not be reproduced. –  m_goldberg Sep 19 '13 at 5:24

Modified after correction...

It looks like you have your correction. This code now works

Nn = 100; R = 50; Cc = .00008; K = 0.5; VP = 1.4; VS = 0.33; VMAX = \
1.0; a = 20; TW = 40.0; TP = 200.0; DT = 1.0; TS = 5.0; TU = 10.0; k1 \
= 1.0; k2 = 10.0; k3 = 1.0; P1 = 0.001; P3 = 0.001;
nw = a*x[t]/(1.0 - x[t]);
np = a*(1.0 - x[t])/x[t]*(VS/VMAX);
M = 50;

NDSolve[{x'[t] == y[t]/(TW + (a*x[t]/(1.0 - x[t]))*DT) -
z[t]/(TP + TU + np*DT)*VP/VMAX - Cc*x[t]*(Nn/M),
y'[t] == P1*(1.0 - x[t]) -
y[t]*(1.0 - k1*E (((nw/k2)^k3)))/(TW + nw*DT),
z'[t] == P3*x[t] -
z[t]*(1.0 -
k1*E ((((a*(1.0 - x[t])/x[t]*(VS/VMAX))/k2)^k3)))/(TP + TU +
np*DT), x[0] == y[0] == z[0] == .1}, {x[t], y[t], z[t]}, {t, 10}]

-
Nn = 800; R = 50; Cc = .0008; K = 0.5; VP = 1.4; VS = 0.33; VMAX = 1.0; a = 20; TW = 40.0; TP = 250.0; DT = 1.0; TS = 5.0; TU = 10.0; k1 = 1.0; k2 = 10.0; k3 = 1.0; P1 = 0.001; P3 = 0.001; nw = a*y (1)/(1.0 - y (1)); np = a*(1.0 - y (1))/y (1)*(VS/VMAX); M = 55; –  squiggles Sep 18 '13 at 0:56
NDSolve[{x'[t] == y[t]/(TW + (ax[t]/(1.0 - x[t]))*DT) - z[t]/(TP + TU + npDT)*VP/VMAX - Ccx[t]*Nn/(2*M), y'[t] == P1*(1.0 - x[t]) - y[t]*(1.0 - k1*E (((nw/k2)^k3)))/(TW + nwDT), z'[t] == P3*x[t] - z[t]*(1.0 - k1*E ((((a*(1.0 - x[t])/x[t]*(VS/VMAX))/k2)^k3)))/(TP + TU + np*DT), x[0] = y[0] = z[0] = .1}, {x[t], y[t], z[t]}, {t, 100}]; –  squiggles Sep 18 '13 at 0:56
That is the entire thing with some minor adjustments. The frustration is that I have no problem at all getting it to work in MATLAB. –  squiggles Sep 18 '13 at 0:57
Can I ask what is y(1) in your equations? This throws a stick in the spokes so to speak, meaning this is not a simple as I thought if you need the system solved with y[1] in the system. In other words your system is expressed in terms of a solution point. The terms nw and np are the only things throwing this off. Someone else might be able to help too. –  J. W. Perry Sep 18 '13 at 1:20
Also, since your code is substantially different, put this in your question. indent 4 spaces, and separate by lineskips before and after. Or maybe try the codeblock button. –  J. W. Perry Sep 18 '13 at 1:25

This is not an answer but an extended comment.

Evaluating J. W. Perry's as it now appears, I get the following for s.

{{x[t] -> InterpolatingFunction[{{0., 10.}}, <> ][t],
y[t] -> InterpolatingFunction[{{0., 10.}}, <> ][t],
z[t] -> InterpolatingFunction[{{0., 10.}}, <> ][t]}}


Making the following settings

solutions = {x[t], y[t], z[t]} /. s[[1]];
endPts = solutions /. t -> 10.;
labels =
Text[Style[#1, 14, "SR", Bold], {10., #2}, {-1.5, 0}] &,
{{"x", "y","z"}, endPts}];


I can then make the plot

Plot[Evaluate@solutions, {t, 0., 10.},