Mathematica newbie here. I have been trying to use NDSolve
to solve two coupled differential equations. Each equation on its own (minus the coupling terms) solves fine, but when I try them both together I get an error. I apologize in advance if my question is stupid or this is not the place to ask it. Here is my code:
FIRST EQUATION:
xb = 1;
kcat = 1;
v = 1;
kp = 1;
kd = 1;
Dp = 1;
Dc = 1;
kform = 1;
NDSolve[
{D[P[x, t], t] == Dp*D[P[x, t], x, x] - kcat*(*C[x,t]*)P[x, t] +
(kp/2)*(1/Sqrt[π*v])*(Exp[-((x - xb)^2)/v] + Exp[-((x + xb)^2)/v]),
(D[P[x, t], x] /. x -> -xb) == 0,
(D[P[x, t], x] /. x -> xb) == 0,
P[x, 0] == 0},
P[x, t], {x, -xb, xb}, {t, 0, 50}]
Quit[]
SECOND EQUATION:
xb = 1;
kcat = 1;
v = 1;
kp = 1;
kd = 1;
Dp = 1;
Dc = 1;
kform = 1;
NDSolve[
{D[C[x, t], t] == Dc*D[C[x, t], x, x] - kd*C[x, t] +
kform*(1/Sqrt[π*v])*Exp[-(x^2)/v],
(D[C[x, t], x] /. x -> -xb) == 0,
(D[C[x, t], x] /. x -> xb) == 0,
C[x, 0] == 5},
C[x, t], {x, -xb, xb}, {t, 0, 50}]
Quit[]
BOTH:
xb = 1;
kcat = 1;
v = 1;
kp = 1;
kd = 1;
Dp = 1;
Dc = 1;
kform = 1;
NDSolve[
{D[P[x, t], t] == Dp*D[P[x, t], x, x] - kcat*C[x, t]*P[x, t],
D[C[x, t], t] == Dc*D[C[x, t], x, x],
(D[P[x, t], x] /. x -> -xb) == 0,
(D[P[x, t], x] /. x -> xb) == 0,
P[x, 0] == 0,
(D[C[x, t], x] /. x -> -xb) == 0,
(D[C[x, t], x] /. x -> xb) == 0,
C[x, 0] == 5},
{P[x, t], C[x, t]}, {x, -xb, xb}, {t, 0, 50}]
Quit[]
ERROR MESSAGE:
NDSolve::ndode: The equations are not differential equations or initial conditions in the dependent variables {P}.
C
is a built-in function, I would not recommend using it as the name of the function involved in your PDE. $\endgroup$