# Function Evaluation in Table [closed]

Apologies in advance: this is a really basic question, and I am sure it has been answered, but I don't know enough mathematica to even find the answer.

I have a differential equation I want to solve. Specifically I want to know the solution at some long time T (say T=50). The differential equation involves some parameters, and I want to define a function to be the solution of the differential equation as a function of these parameters.

What I did was

Solu[w1_, w2_, w3_, alph_, T_] :=
Flatten[Evaluate[{u[T], v[T], w[T], x[T], y[T], z[T]} /.
NDSolve[{u'[t] ==
w1 + x[t] Sin[v[t] - u[t]] + y[t] Sin[w[t] - u[t]],
v'[t] == w2 + x[t] Sin[u[t] - v[t]] + z[t] Sin[w[t] - v[t]],
w'[t] == w3 + y[t] Sin[u[t] - w[t]] + z[t] Sin[v[t] - w[t]],
x'[t] == -alph x[t] + Cos[u[t] - v[t]],
y'[t] == -alph y[t] + Cos[u[t] - w[t]],
z'[t] == -alph z[t] + Cos[v[t] - w[t]], u[0] == 0, v[0] == 0,
w[0] == .0, x[0] == 1, y[0] == 1, z[0] == 1}, {u, v, w, x, y,
z}, {t, 0, T}]]]


Which is fine if I want to find the value at a specified point:

In[202]:= Solu[-1.0, -1, 2, .3, 20]

Out[202] = {-0.107791, -0.107791, 0.215582, 3.32755, 3.14742, 3.14742}


But Mathematica gags if I try to make a table of values, or graph the solutions.

In[203]:= Table[Solu[-x,-1,1+x,.3,50],{x,0,2}]


NDSolve::ndode: Input is not an ordinary differential equation. >>

I understand that this is related to the way mathematica first builds the table and then evaluates, but I don't understand how to fix it.

• Functions which use numeric techniques should have their arguments restricted to numeric values. Solu[w1_?NumericQ, w2_?NumericQ, w3_?NumericQ, alph_?NumericQ, T_?NumericQ] := ... Apr 11, 2016 at 19:00
• Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. Apr 11, 2016 at 19:29

Do not use x as both a dependent variable in NDSolve and an index in Table. Instead, try,
Table[Solu[-a, -1, 1 + a, .3, 50], {a, 0, 2}]