I'm trying to solve the following system:

$$ \dot{x_1} = -i w_1 x_1+ i s_1 x_2 $$ $$ \dot{x_2} = -i w_2 x_2- i s_2 x_1 $$

For $X(t)_{1,2}$, where $x_{1,2} = X(t)_{1,2}\cdot e^{ip(t)_{1,2}}$

I know the solution is:

$$ \dot{X_1}=s_1X_2sin(p_1 - p_2) $$ $$ \dot{X_2}=s_2X_1sin(p_1 - p_2) $$

I tried the following:

x1 = X1[t]*E^(I*p1[t]);
x2 = X2[t]*E^(I*p2[t]);

x1dot = -I*w1*x1 + I*s1*x2;
x2dot = -I*w2*x2 + I*s2*x1;

x1d = D[x1, t];
x2d  = D[x2, t];

{{X1s[t], X2s[t]}} = 
 {X1[t], X2[t]} /.
    {x1d == x1dot, x2d == x2dot},
    {X1[t], X2[t]}]]

But The result I get is:

$$ -\frac{i \left(\text{x1d} \text{p2}'(t)+\text{s1} e^{i \text{p2}(t)} \text{X2}'(t)+\text{w2} \text{x1d}\right)}{e^{i \text{p1}(t)} \left(-\text{w1} \text{p2}'(t)+\text{s1} \text{s2}-\text{w1} \text{w2}\right)},-\frac{i \left(\text{w1} \text{X2}'(t)+\frac{\text{s2} \text{x1d}}{e^{i \text{p2}(t)}}\right)}{-\text{w1} \text{p2}'(t)+\text{s1} \text{s2}-\text{w1} \text{w2}}$$

I'm not sure if Mathematica can use Euler's formula to simplify the complex exponents and get to the known solution. I guess it's possible but I'm not sure how to do it


1 Answer 1


One way to derive the "known solution" is to substitute the expressions for $X_{1,2}(t)$ into the differential equations for $x_{1,2}$ and solve for the derivatives $\dot{X}_{1,2}$. Then take the real parts of $\dot{X}_{1,2}$, like this:


x1 = X1[t] Exp[I p1 t];
x2 = X2[t] Exp[I p2 t];

eqns = {D[x1, t] == -I ω1 x1 + I s1 x2,
   D[x2, t] == -I ω2 x2 - I s2 x1};

soln = First@Solve[eqns, {X1'[t], X2'[t]}];

X1'[t] /. soln // Re // ComplexExpand // Simplify (* s1 Sin[(p1 - p2) t] X2[t] *)
X2'[t] /. soln // Re // ComplexExpand // Simplify (* s2 Sin[(p1 - p2) t] X1[t] *)

Of course, you would need a good argument for taking only the real parts.

  • $\begingroup$ Thank you! Can you please explain what First@Solve is doing? $\endgroup$ Commented May 26, 2021 at 11:52
  • $\begingroup$ The First@Solve can, probably, be understood most easily by running the code with the semicolons removed and again with the First@ part removed and comparing the results. The Solve part returns a list of solutions for the derivatives $\dot{X}_{1,2}$ and the First@ takes only the first solution. In this case there is only one solution, so the effect of First@ is similar to using Flatten. Thanks for accepting this answer. $\endgroup$
    – LouisB
    Commented May 26, 2021 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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