# How to put boundary condition for linear set of differential equation?

I have the following code.

m = {{-1 - a, 0, 1, 0, 0, 0}, {1, -1 - a, 0, 0, 0, 0}, {0, 1, -1 - a, 0, 0, 0}, {a, 0, 0, 0, 0, 0}, {0, a, 0, 0, 0, 0}, {0, 0, a, 0, 0, 0}};

X[t_] = {x1[t], x2[t], x3[t], x4[t], x5[t], x6[t]};

system = X'[t] == m.X[t];

sol = DSolve[system, {x1, x2, x3, x4, x5, x6}, t];


The boundary condition I want to use is $$\begin{pmatrix} x1[0]\\x2[0]\\x3[0]\\x4[0]\\x5[0]\\x6[0]\\\end{pmatrix}=\begin{pmatrix}x\\y\\1-x-y\\0\\0\\0\\ \end{pmatrix}$$ Further more if I want to plot x1[t], how to do that?

• X[0] == {x, y, 1 - x - y, 0, 0, 0} for the IC... – Michael E2 Jun 13 '19 at 1:25

## 1 Answer

It is necessary to add the initial data and define the parameters a,x,y.

m = {{-1 - a, 0, 1, 0, 0, 0}, {1, -1 - a, 0, 0, 0, 0}, {0, 1, -1 - a,
0, 0, 0}, {a, 0, 0, 0, 0, 0}, {0, a, 0, 0, 0, 0}, {0, 0, a, 0, 0,
0}};

X[t_] = {x1[t], x2[t], x3[t], x4[t], x5[t], x6[t]};

system = X'[t] == m.X[t];

sol = DSolve[{system, x1[0] == x, x2[0] == y, x3[0] == 1 - x - y,
x4[0] == 0, x5[0] == 0, x6[0] == 0}, {x1, x2, x3, x4, x5, x6}, t];


Equation solution for x1

f1 = x1 /. sol // First

(*Out[]= Function[{t}, -((4 (3 + 3 a + a^2) E^(-a t) (-1 +
E^(1/2 (-3 - 2 a) t + a t) Cos[(Sqrt[3] t)/2] -
3 E^(1/2 (-3 - 2 a) t + a t) x Cos[(Sqrt[3] t)/2] -
Sqrt[3] E^(1/2 (-3 - 2 a) t + a t) Sin[(Sqrt[3] t)/2] +
Sqrt[3] E^(1/2 (-3 - 2 a) t + a t) x Sin[(Sqrt[3] t)/2] +
2 Sqrt[3] E^(1/2 (-3 - 2 a) t + a t)
y Sin[(Sqrt[3] t)/2]))/(3 (2 Sqrt[3] - I a +
Sqrt[3] a) (2 Sqrt[3] + I a + Sqrt[3] a)))]*)


Plot x1 for for given parameters

Plot[ReIm[f1[t]] /. {a -> .5, x -> .5, y -> .3}, {t, -2.5, 3},
PlotRange -> All, AxesLabel -> {"t", "x1"}]