
Now, let's set up a system of differential equations. So we can solve the system very easily this way. One note about notation: For clarity sake (and to avoid using variable names that begin with capital letters), I will name all matrices beginning with an m (so mA, mC, mWhatever) and all vectors beginning with a v (vX, vSolution, vSomething). The system:Ĭan be written in matrix form with the following definitions: First, let's just set up a system of algebraic equations. Now, let's pull all this together and start using matrix notation. (If you are interested, this makes it so the = sign is "listable", i.e., it works with matrices and other lists.) In order for vector equations to work correctly in Mathematica, you must first execute the following command (this is important, so pay attention): (I will treat all vectors as row vectors, even when it would be more correct to use column vectors.

We will take advantage of this to simplify some work that Mathematica would otherwise force you to do. ), even if the vector isn't really the right kind of vector (i.e., you can be sloppy about row vectors vs. One other thing Mathematica does that is kind of nice is that it handles multiplication of a matrix times a vector properly (if you use. (Sticking //MatrixForm at the end of the line just makes the answer look nice. (Relevant Section:3.4) Mathematica Tasks. between them if you use implied multiplation (or the standard × symbol), Mathematica won't use matrix multiplication. Mathematica 6: Matrix Operation Description: Addition and Multiplication of Matrix and some multiplica- tion puzzles. In fact, you can enter matrices directly (so they actually look like matrices) by using the "Create Table/Matrix/Palette" command under the "Input" menu (then just choose "Matrix" and the number of rows/columns) or, if you need a 2 by 2 matrix, there is a button on the standard tool palette for this. As far as Mathematica is concerned, a vector is just a list of items: A matrix is just a list of lists:, where each inside list is a row of the matrix. To do this, you need to know a few things about how Mathematica handles matrices and vectors. Personally, I prefer to set systems up from the outset as matrix equations. This method works (and is easy to understand), but starts to get kind of cumbersome for larger systems (and certainly doesn't win any cool points.).

The most simplistic method is to just enter them as lists of differential equations: There are a lot of different ways to handle systems of differential equations in Mathematica.

Setting up the systems - working with matrices Solving_differential_equations_with_Mathematica.nb
