3
$\begingroup$

Is it possible to obtain exact solutions of these types of coupled differential equations directly in Mathematica

x'[t]=-I a x[t] + I \Sqrt[2] b y[t]
y'[t]=I \Sqrt[2] b x[t] + I \Sqrt[2] b z[t]
z'[t]=I \sqrt[2] b y[t] - I a z[t]

with initial conditions x[0]=1 and y[0]=z[0]=0 ?

Note: a,b are real constants

$\endgroup$
  • 3
    $\begingroup$ What happens when you feed them into DSolve[]? $\endgroup$ – J. M. is away Apr 24 '16 at 14:43
3
$\begingroup$

Equations use Equal (==) vice Set (=)

eqns = {x'[t] == -I a x[t] + I Sqrt[2] b y[t],
   y'[t] == I Sqrt[2] b x[t] + I Sqrt[2] b z[t],
   z'[t] == I Sqrt[2] b y[t] - I a z[t],
   x[0] == 1, y[0] == z[0] == 0};

soln = DSolve[eqns, {x, y, z}, t][[1]] // FullSimplify

{x -> Function[{t}, 
       (4*b^2*E^((-I)*a*t - (1/2)*I*
                   (a + Sqrt[a^2 + 16*b^2])*
                   t)*(a^2*E^(I*a*t) + 
               16*b^2*E^(I*a*t) + 
               a*Sqrt[a^2 + 16*b^2]*
                 E^(I*a*t) + 2*a^2*
                 E^((1/2)*I*(a + Sqrt[
                           a^2 + 16*b^2])*t) + 
               32*b^2*E^((1/2)*I*
                      (a + Sqrt[a^2 + 16*b^2])*
                      t) + a^2*E^(I*a*t + 
                      (1/2)*I*(-a + Sqrt[
                            a^2 + 16*b^2])*t + 
                      (1/2)*I*(a + Sqrt[
                            a^2 + 16*b^2])*t) + 
               16*b^2*E^(I*a*t + (1/2)*I*
                        (-a + Sqrt[a^2 + 
                             16*b^2])*t + (1/2)*I*
                        (a + Sqrt[a^2 + 16*b^2])*
                        t) - a*Sqrt[a^2 + 
                     16*b^2]*E^(I*a*t + 
                      (1/2)*I*(-a + Sqrt[
                            a^2 + 16*b^2])*t + 
                      (1/2)*I*(a + Sqrt[
                            a^2 + 16*b^2])*t)))/
         ((a^2 + 16*b^2 - 
               a*Sqrt[a^2 + 16*b^2])*
            (a^2 + 16*b^2 + 
               a*Sqrt[a^2 + 16*b^2]))], 
   y -> Function[{t}, 
       -((16*Sqrt[2]*b^3*Sqrt[
                   a^2 + 16*b^2]*(-1 + 
                    E^((1/2)*I*(-a + Sqrt[
                              a^2 + 16*b^2])*t + 
                         (1/2)*I*(a + Sqrt[
                              a^2 + 16*b^2])*t)))/
              E^((1/2)*I*(a + Sqrt[
                        a^2 + 16*b^2])*t)/
            ((-a^2 - 16*b^2 + 
                  a*Sqrt[a^2 + 16*b^2])*
               (a^2 + 16*b^2 + 
                  a*Sqrt[a^2 + 16*b^2])))], 
   z -> Function[{t}, 
       (4*b^2*E^((-I)*a*t - (1/2)*I*
                   (a + Sqrt[a^2 + 16*b^2])*
                   t)*(a^2*E^(I*a*t) + 
               16*b^2*E^(I*a*t) + 
               a*Sqrt[a^2 + 16*b^2]*
                 E^(I*a*t) - 2*a^2*
                 E^((1/2)*I*(a + Sqrt[
                           a^2 + 16*b^2])*t) - 
               32*b^2*E^((1/2)*I*
                      (a + Sqrt[a^2 + 16*b^2])*
                      t) + a^2*E^(I*a*t + 
                      (1/2)*I*(-a + Sqrt[
                            a^2 + 16*b^2])*t + 
                      (1/2)*I*(a + Sqrt[
                            a^2 + 16*b^2])*t) + 
               16*b^2*E^(I*a*t + (1/2)*I*
                        (-a + Sqrt[a^2 + 
                             16*b^2])*t + (1/2)*I*
                        (a + Sqrt[a^2 + 16*b^2])*
                        t) - a*Sqrt[a^2 + 
                     16*b^2]*E^(I*a*t + 
                      (1/2)*I*(-a + Sqrt[
                            a^2 + 16*b^2])*t + 
                      (1/2)*I*(a + Sqrt[
                            a^2 + 16*b^2])*t)))/
         ((a^2 + 16*b^2 - 
               a*Sqrt[a^2 + 16*b^2])*
            (a^2 + 16*b^2 + 
               a*Sqrt[a^2 + 16*b^2]))]}

Verifyng that the solution satisfies the equations and initial conditions

And @@ ((eqns /. soln) // Simplify)

(*  True  *)
$\endgroup$
  • $\begingroup$ thanx. i'm srry, but, i'm getting Equation or list of equations expected instead of True in the first argument {(x^\[Prime])[t]==-I a x[t]+I Sqrt[2] b y[t],(y^\[Prime])[t]==I Sqrt[2] b x[t]+I Sqrt[2] b z[t],True,x[0]==1,y[0]==z[0]==0}. >>. am i inputting it wrong ? $\endgroup$ – ss1729 Apr 24 '16 at 15:14
  • 1
    $\begingroup$ @ss1729, because of your previous definitions with Set= all equations evaluate to True; so you need to re-start the kernel to clear all previously defined symbols. $\endgroup$ – kglr Apr 24 '16 at 15:18
3
$\begingroup$
soln = ParametricNDSolve[{x'[t] == -I a x[t] + I Sqrt[2] b y[t],
   y'[t] == I Sqrt[2] b x[t] + I Sqrt[2] b z[t],
   z'[t] == I Sqrt[2] b y[t] - I a z[t], x[0] == 1, y[0] == 0, 
   z[0] == 0}, {x, y, z}, {t, 0, 20}, {a, b}]

Plot[Through[{Re, Im}@#] & /@ {x[.1, .5][t], y[.1, .5][t], 
    z[.1, .5][t]} /. soln, {t, 0, 10}, Evaluated -> True, 
 PlotLegends -> (Style[#, Italic, 16] & /@ {"Re[x[.1,.5][t]", 
     "Im[x[.1,.5][t]", "Re[y[.1,.5][t]", "Im[y[.1,.5][t]", 
     "Re[z[.1,.5][t]", "Im[z[.1,.5][t]"})]

Mathematica graphics

$\endgroup$
  • $\begingroup$ +1 On my Mac with v10.4.1 the PlotLegends don't show properly unless I use Evaluate with the first argument to Plot. The option Evaluated -> True doesn't work with Plot on later versions. $\endgroup$ – Bob Hanlon Apr 24 '16 at 16:36
  • $\begingroup$ @BobHanlon, right; same on v9 on Windows 10 if i use "Expressions" as the setting for PlotLegends $\endgroup$ – kglr Apr 24 '16 at 16:37

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.