Rule replacement doesn't work after NDSolve?

• To: mathgroup at smc.vnet.net
• Subject: [mg123962] Rule replacement doesn't work after NDSolve?
• From: gac <g.crlsn at gmail.com>
• Date: Mon, 2 Jan 2012 02:48:20 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com

```Can anyone explain why the three rule replacement steps after NDSolve don't work, but the three Plot3D commands do?  Thanks.

n = 2;
tf = 20;
varsx = Table[Subscript[x, i][z, t], {i, n}];
varsy = Table[y[z, t], {i, 1, 1}];

eqnsx = Table[{\!\(
\*SubscriptBox[\(\[PartialD]\), \(t\)]\(
\(\*SubscriptBox[\(x\), \(i\)]\)[z, t]\)\) ==  y[z, t] \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(j = 1\), \(n\)]\(\((i - j)\)\
\(\*SubscriptBox[\(x\), \(j\)]\)[z, t]\)\),
Subscript[x, i][z, 0] == Sin[2 i Pi z]}, {i, n}];

eqnsy = Table[{\!\(
\*SubscriptBox[\(\[PartialD]\), \(t\)]\(y[z, t]\)\) == - y[z, t] +
Exp[-(t - tf/4)^2], y[z, 0] == 0}, {j, 1, 1}];

vars = Join[varsx, varsy];
eqns = Join[eqnsx, eqnsy];

sol = NDSolve[eqns, vars, {t, 0, tf}, {z, 0, 10}, DependentVariables -> vars, MaxStepSize -> 0.01, MaxSteps -> 10^5, Method -> "ExplicitRungeKutta"][[1]]

Subscript[x, 1][0.1, 3] /. sol
Subscript[x, 2][0.1, 1] /. sol
y[0.5, 1] /. sol

Grid[{{Plot3D[y[z, t] /. sol, {t, 0, tf}, {z, 0, 1}, PlotLabel -> "y[z,t]", AxesLabel -> {"t", "z"}, PlotRange -> All, ImageSize -> 400],
Plot3D[Subscript[x, 1][z, t] /. sol, {t, 0, tf}, {z, 0, 1}, PlotLabel -> "\!\(\*SubscriptBox[\(x\), \(1\)]\)[z,t]]", AxesLabel -> {"t", "z"}, PlotRange -> All, ImageSize -> 400]},
{Plot3D[Subscript[x, 2][z, t] /. sol, {t, 0, tf}, {z, 0, 1}, PlotLabel -> "\!\(\*SubscriptBox[\(x\), \(2\)]\)[z,t]", AxesLabel -> {"t", "z"}, PlotRange -> All, ImageSize -> 400],}}]

```

• Prev by Date: Re: Does this make sense?
• Next by Date: Re: Does this make sense?