4
$\begingroup$

Consider a complex linear ODE system $x'=Ax$, where $$A=\left( \begin{matrix} 0&1\\ -2&-i \end{matrix}\right). $$ One can first find the eigenvalues and eigenvectors using JordanDecomposition and get the general solutions with MatrixExp.

Here is my question:
Is there a quick way in Mathematica that I can get the solution in the form such that the real and imaginary parts are separated: $$ v(t)=c_1v_1(t)+c_2iv_2(t) $$ where $v_1(t),v_2(t)\in{\mathbb R}$?

$\endgroup$
2
  • 1
    $\begingroup$ Please post your code using JordanDecomposition and MatrixExp for completeness $\endgroup$ Aug 31, 2014 at 21:53
  • 2
    $\begingroup$ Is there an issue with getting the solution and then using Re and Im to separate the real and imaginary parts? May be coupled with the use of ComplexExpand? A full MWE also helps. $\endgroup$
    – Nasser
    Aug 31, 2014 at 21:56

1 Answer 1

5
$\begingroup$

The linear system is easily solved generally by first calulating the MatrixExp. Then we can extract the real and imaginary parts.

Here we go

The complex matrix

A = {{0, 1}, {-2, -I}};

The matrix exp

At = MatrixExp[t A]

(* {{1/3 (2 Cos[t] + Cos[2 t] + I (2 Sin[t] - Sin[2 t])), 
  1/3 (I (-Cos[t] + Cos[2 t]) + Sin[t] + Sin[2 t])}, {1/
   3 (2 I (Cos[t] - Cos[2 t]) - 2 (Sin[t] + Sin[2 t])), 
  1/3 (Cos[t] + 2 Cos[2 t] + I (Sin[t] - 2 Sin[2 t]))}} *)

In matrix form:

At // MatrixForm

$$\left( \begin{array}{cc} \frac{1}{3} (2 \text{Cos}[t]+\text{Cos}[2 t]+i (2 \text{Sin}[t]-\text{Sin}[2 t])) & \frac{1}{3} (i (-\text{Cos}[t]+\text{Cos}[2 t])+\text{Sin}[t]+\text{Sin}[2 t]) \\ \frac{1}{3} (2 i (\text{Cos}[t]-\text{Cos}[2 t])-2 (\text{Sin}[t]+\text{Sin}[2 t])) & \frac{1}{3} (\text{Cos}[t]+2 \text{Cos}[2 t]+i (\text{Sin}[t]-2 \text{Sin}[2 t])) \\ \end{array} \right)$$

The general solution vector is (where a == x[0] and b = y[0] are two constants)

{x, y} = At.{a, b}

(* {1/3 a (2 Cos[t] + Cos[2 t] + I (2 Sin[t] - Sin[2 t])) + 
  1/3 b (I (-Cos[t] + Cos[2 t]) + Sin[t] + Sin[2 t]), 
 1/3 b (Cos[t] + 2 Cos[2 t] + I (Sin[t] - 2 Sin[2 t])) + 
  1/3 a (2 I (Cos[t] - Cos[2 t]) - 2 (Sin[t] + Sin[2 t]))} *)

Direct proof that {x,y} solves the ODE

D[{x, y}, t] == A.{x, y} //Simplify

(* True *)

Ok.

Now we can calculate Re and Im of the matrix At

reAt = 1/2 ComplexExpand[At + Conjugate[At]];
reAt//MatrixForm

$\left( \begin{array}{cc} \frac{1}{2} \left(\frac{4 \text{Cos}[t]}{3}+\frac{2}{3} \text{Cos}[2 t]\right) & \frac{1}{2} \left(\frac{2 \text{Sin}[t]}{3}+\frac{2}{3} \text{Sin}[2 t]\right) \\ \frac{1}{2} \left(-\frac{4 \text{Sin}[t]}{3}-\frac{4}{3} \text{Sin}[2 t]\right) & \frac{1}{2} \left(\frac{2 \text{Cos}[t]}{3}+\frac{4}{3} \text{Cos}[2 t]\right) \\ \end{array} \right)$

imAt = 1/(2 I)  ComplexExpand[At - Conjugate[At]];
imAt//MatrixForm

$\left( \begin{array}{cc} \frac{1}{2} \left(\frac{4 \text{Sin}[t]}{3}-\frac{2}{3} \text{Sin}[2 t]\right) & \frac{1}{2} \left(-\frac{2 \text{Cos}[t]}{3}+\frac{2}{3} \text{Cos}[2 t]\right) \\ \frac{1}{2} \left(\frac{4 \text{Cos}[t]}{3}-\frac{4}{3} \text{Cos}[2 t]\right) & \frac{1}{2} \left(\frac{2 \text{Sin}[t]}{3}-\frac{4}{3} \text{Sin}[2 t]\right) \\ \end{array} \right)$

Check the decomposition

At == reAt + I imAt // Simplify

(*  True *)

Similarly you can decompose the solution vector {x,y}, which will result in slightly longer expressions in the case of complex initial values a and b.

Best regards, Wolfgang

$\endgroup$
1
  • $\begingroup$ This is very helpful! $\endgroup$
    – user664
    Sep 1, 2014 at 16:56

Your Answer

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