MathGroup Archive 1998

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

Search the Archive

Re: Numerical Solution to a System of Differential Equations...




----------
In article <6ibvba$ev@smc.vnet.net>, Ragavan
<rm2d@csis5.ee.virginia.edu> wrote:

>I have been trying (unsuccessfully) to numerically solve a system of
>differential equations of the form y'=M.y, where y', M and y are all
>matrices. I also specify an initial value matrix Init which will be
>assigned to y0, the initial value vector.
>
>Now, I try to solve using NDSolve:
>
>In[4]:= NDSolve[ {MapThread[Equal,{y', M.y}],
>MapThread[Equal,{y0,Init}]}, 
>        y, {t,0,10}]
>
>and obtain an output which looks like this:
>
>Out[4]={y1[t]\[Rule]InterpolatingFunction[{{0.`,10.`}},"<>"][t],
>        y2[t]\[Rule]InterpolatingFunction[{{0.`,10.`}},"<>"][t],
>        y3[t]\[Rule]InterpolatingFunction[{{0.`,10.`}},"<>"][t]}}
>
>(y1, y2, y3 are elements in the y vector.)
>
>But when I try to look at the result for a given value of the dependent
>variable t (say 5):
>
>In[5]:= y3[5] /. %
>
>all I get is
>
>Out[5]= y3[5]

Ragavan:

No rule in Out[4] matches y3[5]; but you might try:

y3[t]/.%4[[1]]/.t->5     (*[[1]] extracts the inner list*)

Alternatively:
y2[t] ...}.
If you set y0 = {y1,y2,...}
Then the solution  will be for the functions y1,y2, ..and will be of the
form

fnSoln= {{y1\[Rule]InterpolatingFunction[{{0.`,10.`}},"<>"],
>        y2\[Rule]InterpolatingFunction[{{0.`,10.`}},"<>"],
>        y3\[Rule]InterpolatingFunction[{{0.`,10.`}},"<>"]}}
Then try

(y3/. fnSoln[[1]])[5]





  • Prev by Date: Formating output for email
  • Next by Date: Finding Optimal Integer Ratio for Any Decimal Fraction
  • Prev by thread: Numerical Solution to a System of Differential Equations...
  • Next by thread: Re: Numerical Solution to a System of Differential Equations...