MathGroup Archive 2009

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

Search the Archive

Re: NDSolve to solve a set of "loop" equations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101374] Re: NDSolve to solve a set of "loop" equations
  • From: Pillsy <pillsbury at gmail.com>
  • Date: Fri, 3 Jul 2009 05:39:31 -0400 (EDT)
  • References: <h2i4rd$94c$1@smc.vnet.net>

On Jul 2, 7:14 am, Haibo Min <yshdf... at gmail.com> wrote:
> Hi, there.

> I am new to mathematica and recently I am intrigued by the convenience of
> NDSolve function, since there is no need to write the Runge-kutta like
> functions myself to solve ODEs. However, if what I want to solve is a lis=
t
> of equations expressed in a loop way, I have no idea how to express it.

> For example, a set of simple equations are:
> Subscript[y, i]'[x]  = Subscript[y, i][x] Cos[x + Subscript[y, i][x]]=
 + i,
> where i=1,2,...,N;

This is almost certainly not what you want, because, like in a few
other languages, "=" is an assignment operatore, whereas "==" is the
test for equality. So instead you'd want

Subscript[y, i]'[x] == Subscript[y, i][x] Cos[x + Subscript[y, i][x]]
+ i

In order to create a list of these, for i rangeing from 1...n, you
want to use Mathematica's Table construct. This function will generate
a list of n equations, for a positive integer n:

eqns[n_Integer] /; Positive[n] :=
  Table[Subscript[y, i]'[x] == Subscript[y, i][x] Cos[x + Subscript[y,
i][x]] + i, {i, n}];

HTH,
Pillsy


  • Prev by Date: Re: Eye of Ra :ellipse_self_similar
  • Next by Date: Re: Bug Report: Excessively thin Thin?
  • Previous by thread: Re: Union slowdown when SameTest is specified
  • Next by thread: Re: Re: NDSolve to solve a set of "loop" equations