Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Lists of Equations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106358] Re: [mg106307] Lists of Equations
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Sun, 10 Jan 2010 03:30:18 -0500 (EST)
  • Reply-to: hanlonr at cox.net

It is generally more convenient to use the form z[1][x] rather than z1[x]

n = 3;

yVar = Array[y, n];

zVar = Array[z, n];

zx = Through[zVar[x]]

{z[1][x], z[2][x], z[3][x]}

which is equivalent to

zx = (#[x] & /@ zVar)

{z[1][x], z[2][x], z[3][x]}

dy = D[Through[yVar[x]], x]

{Derivative[1][y[1]][x], Derivative[1][y[2]][x], Derivative[1][y[3]][x]}

which is equivalent to

dy = (#'[x] & /@ yVar)

{Derivative[1][y[1]][x], Derivative[1][y[2]][x], Derivative[1][y[3]][x]}

eqs = Thread[dy == zx]

{Derivative[1][y[1]][x] == z[1][x], Derivative[1][y[2]][x] == z[2][x], 
   Derivative[1][y[3]][x] == z[3][x]}

Bob Hanlon

---- Michael Knudsen <micknudsen at gmail.com> wrote: 

=============
Hello,

I have just started using Mathematica, and I wonder what the easiest
way to manage a large set of equations is. I have a bunch of
differential equations

y1'[x] = z1[x]
y2'[x] = z2[x]
...
yn'[x] = zn[x]

and I have grouped them together in a list like

eqs = {y1'[x]==z1[x], ..., yn'[x]==zn[x]}

which fits perfectly as an argument to NDSolve. However, I think that,
at a later point, I may have to use z1,...,zn separately, and I
thought about defining

yeqs = {y1'[x],...,yn'[x]}
zeqs = {z1[x],...,zn[x]}

and them combine them. What I would really like is something like

yeqs + "==" + zeqs

but I can't seem to find any list operation that will do that. Any
help is appreciated.

Thanks,
Michael Knudsen


--

Bob Hanlon



  • Prev by Date: Re: Symbolic Formula
  • Next by Date: Re: More /.{I->-1} craziness
  • Previous by thread: Re: Lists of Equations
  • Next by thread: The location of documentation center file