# Parametric Plot of coupled differential equations

I am able to plot a graph of all the differential equations, but I'd like a parametric plot of each individual one. Here is what I have so far.

new = Join[
Table[x[i]''[t] == - x[i][t] +
0.1*(x[i + 1][t] - 2*x[i][t] + x[i - 1][t]), {i, 1,
9}], {x[0]'[t] == -x[0][t], x[10]'[t] == x[9][t], x[0][0] == 0,
x[1][0] == 1}, Table[x[i][0] == 0, {i, 2, 10}],
Table[x[i]'[0] == 1, {i, 1, 9}]];

Solt[i_] = NDSolve[new, Table[x[i][t], {i, 0, 10}], {t, 10}]

Plot[Evaluate[Table[x[i][t], {i, 10}] /. Solt[i_]], {t, 0, 10}]

Table[ParametricPlot[
Evaluate[{x[i][t], x[i]'[t]} /. Solt[i_]], {t, 0, 10}], {i, 1, 10}]


What is wrong with the parametric plot. I've done this one before (without the added forcing term). It won't show up.

-
That's easy to fix: (a) leave out the underscore in Solt[i_] except in the first instance where you need a pattern in the definition. (b) Leave out the [t] in NDSolve[new, Table[x[i][t]... (I think I added that in my previous answer to your question, but it's not what you were expecting in the post-processing). With the additional [t] argument the replacement rule Solt doesn't get applied to derivatives of the functions.. –  Jens Jun 13 '13 at 2:43

The problem lies only in the way you define the solution Solt. The index i in Solt[i_] isn't appropriate because Solt is supposed to be a single List.

Apart from this, you have two options to specify what NDSolve returns: either the functions x[i] (which yield numerical values when applied to a numerical argument) or the expressions x[i][t] which yield numerical values when t is simply replaced by a number. From the Plot functions in your example, it is clear that you expect the former, i.e., x[i], because in the second set of plots we need to form the Derivative: x[i]'[t]. This is not matched by a the patterns in Solt if it contains replacement rules of the form x[i][t] -> InterpolatingFunction[{{0.,10.}},<>][t]. So we have to instruct NDSolve to return the solutions as functions:

new = Join[
Table[x[i]''[t] == -x[i][t] +
0.1*(x[i + 1][t] - 2*x[i][t] + x[i - 1][t]), {i, 1,
9}], {x[0]'[t] == -x[0][t], x[10]'[t] == x[9][t], x[0][0] == 0,
x[1][0] == 1}, Table[x[i][0] == 0, {i, 2, 10}],
Table[x[i]'[0] == 1, {i, 1, 9}]];

Solt = NDSolve[new, Table[x[i], {i, 0, 10}], {t, 10}];

Plot[Evaluate[Table[x[i][t], {i, 10}] /. Solt], {t, 0, 10}]


Table[ParametricPlot[
Evaluate[{x[i][t], x[i]'[t]} /. Solt], {t, 0, 10}], {i, 1, 10}]


This is not the only way to do things, though. If you have instead defined

Solt = NDSolve[new, Table[x[i][t], {i, 0, 10}], {t, 10}];


then it's still possible to do the plots you wanted. We just have to form the desired derivatives of the returned expressions. This can be done using D instead of Derivative (the latter is what the ' operation corresponds to):

Map[
ParametricPlot[
Evaluate[{#1, D[#1, t]}],
{t, 0, 10}] &,
Table[x[i][t], {i, 10}] /. Solt[[1]]
]


which produces the same plot as above. Here I moved the formation of the Table to the end so that the ParametricPlot can use it to pait each x[i][t] with the corresponding derivative.

In the last code snippet, there is another change compared to your code: I replaced Solt by Solt[[1]]. This is because the solution Solt as defined above is a list of lists, and we only want a single list so that the shape of the Table is flat and leads to a list of different ParametricPlots when Map runs over its first level.

-
Thanks a lot. I appreciate your help! –  Slightly Jun 13 '13 at 13:49