0
$\begingroup$

I have a matrix for example: $\begin{bmatrix} 0 & 5 & 0 & 3 & 3\\ 5 & 5 & 5 & 3 & 1\\ 0 & 3 & 0 & 3 & 10\\ 1 & 3 & 2 & 3 & 10 \\ 1 & 2 & 3 & 4 & 5 \end{bmatrix}$ representing a set of differential equations: $\begin{cases} 5x_{2} + 3x_{4} + 3x_{5} = \frac{dx_{1}}{dt}\\ 5x_{1} + 5x_{2} + 5x_{3} + 3x_{4} + x_{5}= 0\\ 3x_{2} + 3x_{4} + 10x_{5} = \frac{dx_{3}}{dt}\\x_{1} + 3_{2} + 2x_{3} + 3x_{4} + 10x_{5} = 0\\ x_{1} + 2x_{2} + 3x_{3} + 4x_{4} + 5x_{5} = \frac{dx_{5}}{dt}\end{cases}$ where $\frac{dx_{2}}{dt}=0$ and $\frac{dx_{4}}{dt}=0$

Dsolve cannot take the case of $\frac{dx_{2}}{dt}=0$ and $\frac{dx_{4}}{dt}=0$; while LinearSolve cannot solve differential equations. How can I incorporate the two methods to solve a set of differential equations like that? It would be great if the input of matrix (which can be used in DSolve and LinearSolve) can be used conveniently to represent such system (without typing the whole set of equations as I have about 50 equations). For example, http://reference.wolfram.com/language/tutorial/DSolveSystemsOfLinearODEs.html

Can someone help me? Thank you very much.

(Note: The above set of differential equations is just arbitrary, may not be consistent or solvable.)

$\endgroup$
  • $\begingroup$ Do you want to solve all seven equations, including dx2/dt = 0 and dx4/dt = 0? Or just the five on the left, the three differential and two algebraic equations? You basically have five unknowns. In general, you can't solve the system of seven, but you can solve the DAE with five equations. $\endgroup$ – Michael E2 Feb 17 '15 at 13:11
  • $\begingroup$ For instance, the first example in tutorial/DSolveExamplesOfDAEs is similar to, albeit much simpler than, your DAE system of five equations. $\endgroup$ – Michael E2 Feb 17 '15 at 13:24
  • $\begingroup$ Thanks. I want to solve 5 differential equations. dx2/dt = 0 and dx4/dt = 0 are the values of the right hand side of the 2nd and 4th equations. I can normally do that in DSolve (solving a set of linear ODEs); but now I simplify the systems by making dx2/dt = 0 and dx4/dt = 0. $\endgroup$ – Ka-Wa Yip Feb 17 '15 at 19:11
2
$\begingroup$

Here's my interpretation:

SeedRandom[0];
matrix = RandomInteger[10, {5, 5}];
zero = {2, 4};  (* equations to set to zero *)
eqns = matrix.Array[x[#][t] &, 5] == Array[x[#]'[t] &, {5}] /. 
   x[Alternatives @@ zero]'[t] -> 0;
eqns /. x[i_Integer] :> Subscript[x, i] // Thread // MatrixForm

Mathematica graphics

{sol0} = DSolve[eqns, Array[x, 5], t];
sol0 // Short

Mathematica graphics

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.