3
$\begingroup$

I want to solve a large system of 500 by 500 differential equations such that I have equations such as: Note all the A1, A2 are just constants, that are not necessarily equal.

y1'[t]= A1*y1[t]+ B1*y2[t]+...+Z1*y500[t]
y2'[t]= A2*y1[t]+ B2*y2[t]+...+Z2*y500[t]
.
.
.
y500'[t]=A500*y1[t]+ B500*y2[t]+...+Z500*y500[t]

In the Mathematica documentation, I have found some tutorials on how to do this for a 2x2 matrix, but not for large matrices.

Thanks!

$\endgroup$
3
$\begingroup$

Since the equation is linear, we know that the answer is a matrix exponential. See for example, the section on linear differential equations in Wikipedia, which shows that the solution to a vector-valued linear ordinary differential equation $\frac{d y(t)}{dt} = A y(t)$ is $y(t) = e^{A t} y_0$.

The code below sets up a n by n matrix (randomly) and the matrix exponential is calculated. A random initial vector init is chosen, and then the n trajectories starting at init are plotted.

n = 10;
m = RandomReal[{-1, 1}, {n, n}];
exp[t_] := MatrixExp[m t];
init = RandomReal[{-1, 1}, n];
Plot[exp[t].init, {t, 0, 1}]

enter image description here

For the specifics of the OPs case, the matrix m contains all the A1, B1, A2, B2 etc parameters.

$\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.