MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: NDSolve with arrays

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89227] Re: NDSolve with arrays
  • From: Oliver Ruebenkoenig <ruebenko at uni-freiburg.de>
  • Date: Fri, 30 May 2008 02:56:17 -0400 (EDT)
  • References: <g1m8ev$ia$1@smc.vnet.net>

How about,

n = 10;
x0 = 1;
x1 = 10;

play[x_] := IntegerPart[x]

eq1[j_] := {D[ToExpression["f" <> ToString[j]][x], x] ==
       ToExpression["f" <> ToString[play[j]]][x],
     ToExpression["f" <> ToString[j]][x0] == j^2}

eqs = Flatten[Table[eq1[j], {j, 1, n}]]
fun = Flatten[Table[ToExpression["f" <> ToString[j]], {j, 1, n}]]
tes = NDSolve[eqs, fun, {x, x0, x1}][[1]];

Oliver

On Thu, 29 May 2008, svend wrote:

> hi all,
> i want to solve a PDE by discretizing in one variable in an array and solve. the equations are of the following type:
> n = 10;
> x0 = 1;
> x1 = 10;
>
> play[x_] := IntegerPart[x]
>
> eq1 := {D[f[j][x], x] == f[play[x]][x], f[j][x0] == j^2}
>
> eqs = Flatten[Table[eq1, {j, 1, n}]]
> fun = Flatten[Table[f[j], {j, 1, n}]];
> tes = NDSolve[eqs, fun, {x, x0, x1}][[1]];
>
> my problem is that the variable x, in which the equation is differential, also appears on the rhs in the "index" of my array. mathematica does not evaluate "play[x]" during NDSolve and just tells me that the rhs is not numerical. I tried "_NumericQ" and similar things but nothing seems. I would be very happy if someone could tell me how to resolve this.
>
> thanks
> svend
>
>

Oliver Ruebenkoenig, <ruebenko AT uni-freiburg.de>


  • Prev by Date: Re: Exporting the output of GraphPlot
  • Next by Date: ContourPlot3D appearance
  • Previous by thread: NDSolve with arrays
  • Next by thread: FindFit with constraints is slow