DSolve gets stuck on system of differential equations with unassigned variable

Hopefully someone can help me with this problem. I'm running a fairly simple script that involves some matrix operations and ends with a fairly nasty system of differential equations:

h2 = {{0, -(Ω/2)}, {-(Ω/2), -k v + Δ}}

ρ = {{ρ11[t], ρ12[t]}, {ρ21[t], ρ22[t]}}

ρprime = -I (h2.ρ - ρ.h2) + {{1/2 γ ρ22[t], -γ ρ12[t]}, {-γ ρ21[t], -(1/2) γ ρ22[t]}}

replace3 = {Δ -> 0.1, γ -> 1, Ω -> 0.1, k -> 0.1};

p3 = DSolve[{ρ11'[t] == ρprime[[1, 1]], ρ12'[t] == ρprime[[1, 2]],
ρ21'[t] == ρprime[[2, 1]], ρ22'[t] == ρprime[[2, 2]],
ρ11 == 1, ρ22 == 0, ρ12 == 0, ρ21 == 0} /. replace3,
{ρ11[t], ρ12[t], ρ21[t], ρ22[t]}, {t}]

Basically, I'm trying to solve a system of four differential equations analytically, with one variable, v, left unassigned. It is very important that v not be assigned a value as this point in the script. However, when I run it, it gets stuck on the DSolve part and can't seem to do it. When I first assign v a value and then run it, the DSolve works fine. Is this system of equations simply to complicated to be solved analytically? Is there another way to do this?

• Post code, not pictures of code. – Marius Ladegård Meyer Jul 30 '18 at 8:42
• For some web browsers you can install an add-on that lets you format the Greek letters. See the answer to Additional useful buttons for our M.SE editor for information. – LouisB Jul 30 '18 at 9:36
• You should be able to copy and paste the code directly from Mathematica. Please do that - nobody is going to copy your code down from the image :) – Carl Lange Jul 30 '18 at 11:35
• Edit: Added code. – Caleb Horwitz Jul 30 '18 at 21:36
• You may be able to simplify the system by using the fact that $\rho_{11}+\rho_{22}$ is a constant and $\rho_{12}+\rho_{21}$ is another constant. The initial conditions provide the values of the constants. – LouisB Jul 30 '18 at 23:37

The problem can be solved with LaplaceTransform in about 10 seconds:

h2 = {{0, -Ω/2}, {-Ω/2, -k v + Δ}};
ρ = {{ρ11[t], ρ12[t]}, {ρ21[t], ρ22[t]}};
ρprime = -I (h2.ρ - ρ.h2) + {{1/2 γ ρ22[t], -γ ρ12[t]}, {-γ ρ21[t], -1/2 γ ρ22[t]}};
replace3 = {Δ -> 1/10, γ -> 1, Ω -> 1/10, k -> 1/10};

var = Flatten@ρ;

{eq, ic} = {D[var, t] == Flatten@ρprime // Thread,
var == {1, 0, 0, 0} /. t -> 0 // Thread} /. replace3

tvar = LaplaceTransform[var, t, s];
tsol = tvar /. First@Solve[LaplaceTransform[eq, t, s] /. Rule @@@ ic, tvar] // Simplify

(sol = InverseLaplaceTransform[tsol, s, t]) // AbsoluteTiming
(* {10.324655, ……} *)

The result involves Roots, if you don't like it, just add a ToRadicals.

• would it be possible to use this method to implicitly plot the equation v=b-t ρ11[t] , where b is a constant and ρ11[t] is a solution to the system that depends on t and v? – Caleb Horwitz Apr 9 at 22:22
• @CalebHorwitz It's another question that can be solved with ContourPlot, isn't it? – xzczd Apr 10 at 3:19
• I've tried running ρsol22 = Simplify[sol[[2, 2]], {v > 0, t > 0}]; followed by ContourPlot[v == 10^3 - t Re[ρsol22], {t, 0, 10}, {v, 0, 10^3}], but nothing comes up on the plot. Why? – Caleb Horwitz Jun 17 at 15:42
• @CalebHorwitz Use e.g. {v, 0, 2 10^3} instead. – xzczd Jun 17 at 15:57
• in generalizing this script to higher dimensions, is there any way to speed up the computation? I tried using a similar method with 3x3 matrices, and it won't seem to finish. – Caleb Horwitz Sep 24 at 5:30