Hello everyone.(adsbygoogle = window.adsbygoogle || []).push({});

This is my first post after looking for information about a simple question. Unfortunately I didn't found information in any other posts in this forum so, here we go!

I'm trying to solve numerically a set of N ODEs with Mathematica 7.0. Let me callx(t) an array of N elements andMa NxN matrix. I would like to solve the problem dx/dt = -Mx.

So I firstly define the array:

with a "pseudo" Dirac Delta initial condition:Code (Text):

X[t_] = Table[xi[i, t], {i, N}];

This system can be solved with NDSolve:Code (Text):

X0 = SparseArray[Table[{i} -> 0, {i, N}]];

X0[[N/2]] = 1;

If I plot the solution I can check the correct answer:Code (Text):

eqns = Thread /@ {X'[t] == -M.X[t], X[0] == X0};

sol = NDSolve[eqns, X[t], {t, 0, 1}];

And here comes my question.Code (Text):

Plot[Evaluate[Table[xi[i, t] /. sol, {i, N}]], {t, 0, 1}]

How to obtain a specific value of xi (e.g., xi[1,0.1])?

I tried to do it using directlybut the answer was simplyCode (Text):xi[1, 0.1] /. sol. Using Flatten I obtain the same result (without the braces) and if I try withCode (Text):{xi[1, 0.1]}I obtain an array of elements xi[i,0.1] with i=1,N.Code (Text):X[0.1]/.sol

At this point I have no idea of how to deal with this. I am quite sure that this has to be a silly question but, as far as I know, I cannot obtain the correct answer.

Thank you very much in advanced and my apologies if this is a duplicated question.

Best regards,

Arturo.

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# NDSolve in matrix system with Mathematica

Loading...

Similar Threads - NDSolve matrix system | Date |
---|---|

Mathematica Summing matrix components | Thursday at 3:56 PM |

Mathematica Rescaling equations in Mathematica | May 5, 2017 |

NDSolve coupled ode | Sep 4, 2015 |

Mathematica NDSolve different solutions same eq's | Jul 23, 2015 |

Solving ODE numerically in Mathematica - I get 'ndnum' error | Mar 17, 2015 |

**Physics Forums - The Fusion of Science and Community**