# NDSolve doesn't solve my system of ODEs

What is causing the error in this code?

N0 = 4; μ = 2; ρ = 1; d = 1; n = 1;
eqone = Flatten[
Join[
Table[x[i]''[t] == ϵ*(1 - x[i][t]^2)*x[i]'[t] - x[i][t] + d (z[t] - x[i][t]),
{i, 0, N0}],
{z'[t] == ρ*d/n (Sum[x[i][t] - z[t], {i, 0, N0}])}, z[0]==0,
x[0][0] == 1, x[0]'[0] == .5, x[N0/2][0] == 0, x[N0/2]'[0] == 0},
Table[x[i]'[0] == 0, {i, 1, N0/2 - 1}],
Table[x[i][0] == 0, {i, 1, N0/2 - 1}],
Table[x[i]'[0] == 0, {i, N0/2 + 1, N0}],
Table[x[i][0] == 0, {i, N0/2 + 1, N0}]
]
]


and once I get my equations, I should be able to solve the differential equation, but it isn't working. I get a message that starts out:

The function value is not a list of numbers with dimensions ...

I think I have to flatten something again in the NDSolve, but I'm not entirely sure how to do that and why.

eqtwo = NDSolve[eqone, {Table[x[i], {i, 0, N0}],z}, {t, 100}]


## 1 Answer

This seems to be a combination of simple errors. If I give ϵ a value (I used 0.1), and fix some delimiter errors in eqone and add z properly to the list of unknowns in eqtwo, I get a solution.

N0 = 4; μ = 2; ρ = 1; d = 1; n = 1; ϵ = 0.1;

eqone = Flatten[
Join[Table[
x[i]''[t] == ϵ*(1 - x[i][t]^2)*x[i]'[t] - x[i][t] +
d (z[t] - x[i][t]), {i, 0, N0}],
{z'[t] == ρ*d/n (Sum[x[i][t] - z[t], {i, 0, N0}]), z[0] == 0,
x[0][0] == 1, x[0]'[0] == .5,
x[N0/2][0] == 0, x[N0/2]'[0] == 0},
Table[x[i]'[0] == 0, {i, 1, N0/2 - 1}],
Table[x[i][0] == 0, {i, 1, N0/2 - 1}],
Table[x[i]'[0] == 0, {i, N0/2 + 1, N0}],
Table[x[i][0] == 0, {i, N0/2 + 1, N0}]]];

eqtwo = NDSolve[eqone, Append[Table[x[i], {i, 0, N0}], z], {t, 100}]


{{x[0]->InterpolatingFunction[{{0.,100.}},<>],
x[1]->InterpolatingFunction[{{0.,100.}},<>],
x[2]->InterpolatingFunction[{{0.,100.}},<>],
x[3]->InterpolatingFunction[{{0.,100.}},<>],
x[4]->InterpolatingFunction[{{0.,100.}},<>],
z->InterpolatingFunction[{{0.,100.}},<>]}}

### Edit

The OP asked for more info about Append. This is a basic Mathematica function. I recommend reading the Wolfram docs on Append

• Thank you so much! That helps a lot. :) – Slightly Jul 21 '13 at 0:09