2

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[0] == 1, ρ22[0] == 0, ρ12[0] == 0, ρ21[0] == 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?

xzczd
  • 65,995
  • 9
  • 163
  • 468

1 Answers1

3

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.

xzczd
  • 65,995
  • 9
  • 163
  • 468
  • 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 09 '19 at 22:22
  • @CalebHorwitz It's another question that can be solved with ContourPlot, isn't it? – xzczd Apr 10 '19 at 03: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 '19 at 15:42
  • @CalebHorwitz Use e.g. {v, 0, 2 10^3} instead. – xzczd Jun 17 '19 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 '19 at 05:30
  • @CalebHorwitz That really depends. Please add the specific code to the question, or ask a new question if the sample is largely different from the current one. – xzczd Sep 24 '19 at 05:39
  • I posted a new question here – Caleb Horwitz Oct 01 '19 at 23:34
  • @xzcd would this method work for solving nonlinear coupled systems of equations? – Caleb Horwitz Feb 10 '20 at 09:22
  • @cal No, Laplace transform is not magic. For more info please check the property of Laplace transform carefully. – xzczd Feb 11 '20 at 02:30