# Solving coupled differential equations with unknown constants

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

• What happens when you feed them into DSolve[]? Commented Apr 24, 2016 at 14:43

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  *)
• 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 ? Commented Apr 24, 2016 at 15:14
• @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.
– kglr
Commented Apr 24, 2016 at 15:18
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]"})]

• +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. Commented Apr 24, 2016 at 16:36
• @BobHanlon, right; same on v9 on Windows 10 if i use "Expressions" as the setting for PlotLegends
– kglr
Commented Apr 24, 2016 at 16:37