Let's say I have a simple vector-valued ODE given by

$y'(t) = K*y(t)$

where K is a matrix $K_{n_{X}n}$. Let's assume that the matrix is $K_{21_{X}21}$,

$K = \left[\begin{array}{cccc} k_{1_{X}1} & k_{1_{X}2} & \cdots & k_{1_{X}21} \\ k_{2_{X}1} & k_{2_{X}2} & \cdots & k_{2_{X}21} \\ \vdots & \vdots & \ddots & \vdots \\ k_{21_{X}1} & k_{21_{X}2} & \cdots & k_{21_{X}21} \end{array} \right] $

As long as I know (and I don't know much because I've been working with Mathematica for just a couple weeks), I should provide the initial conditions with the same lenght that the matrix K, so $y[0]=\left\{y_{1},...,y_{21}\right\}$, right? So my question is, can I relate a specifc number $k_{n,m}$ of the matrix to a specific number $y_{i}$ of the initial conditions to solve the ODE? So, for example:

$y'[0]=k_{1_{X}1}*y_{1}$; $ y'[0]=k_{1_{X}2}*y_{1}$; $... y'[0]=k_{1_{X}21}*y_{1}$;
$y'[1]=k_{2_{X}1}*y_{2}$; $y'[1]=k_{2_{X}2}*y_{2}$; $... y'[1]=k_{2_{X}21}*y_{2}$;
$y'[20]=k_{20_{X}1}*y_{20}$;$y'[20]=k_{20_{X}2}*y_{20}$; $y'[20]=k_{20_{X}20}*y_{20}$

Is that possible to build and solve an ODE like that or is that exactly what MA does? Basically I want to solve the differential equation for each value of $k$. I'm used to program using fortran so I'm still building the code on MA thinking on my background on fortran language, where I'd solve it in a 'do' loop. I hope I made myself clear enough to anyone help me with that. Thank you.

  • $\begingroup$ Related: mathematica.stackexchange.com/q/77922 (DSolve), mathematica.stackexchange.com/q/14407 (NDSolve) ... many others related questions for NDSolve, too $\endgroup$ – Michael E2 May 12 '15 at 3:54
  • $\begingroup$ I'm a little confused by your notation here. When you say $y'[0] = k_1x1 * y_1$, the left-hand side of the equation looks like a vector of 21 components, while the right-hand side looks like a scalar. But you can't set those equal to each other, so obviously I'm missing something. $\endgroup$ – Michael Seifert May 12 '15 at 3:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.