Re: Re: NDSolve to solve a set of "loop" equations
- To: mathgroup at smc.vnet.net
- Subject: [mg101387] Re: [mg101374] Re: NDSolve to solve a set of "loop" equations
- From: Haibo Min <yshdfeng at gmail.com>
- Date: Sat, 4 Jul 2009 06:43:30 -0400 (EDT)
- References: <h2i4rd$94c$1@smc.vnet.net> <200907030939.FAA19308@smc.vnet.net>
Thanks Pillsy, a really elegant express! Best regards, haibo On Fri, Jul 3, 2009 at 5:39 PM, Pillsy <pillsbury at gmail.com> wrote: > 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 > >
- References:
- Re: NDSolve to solve a set of "loop" equations
- From: Pillsy <pillsbury@gmail.com>
- Re: NDSolve to solve a set of "loop" equations