I'm trying to speed up this code that seems to take forever to evaluate. I'm solving a system of 9 coupled differential equations using a Laplace transform (a version of this code that works perfectly for a system of 4 equations was created in an answer to this question previously posted by me).
h2 = {{0, 0, -Ω1}, {0, -Δ1 + Δ2 + k1 v - k2 v, -Ω2}, {-Ω1, -Ω2, -Δ1 + k1 v}};
ρ = {{ρ11[t], ρ12[t], ρ13[t]}, {ρ21[t], ρ22[t], ρ23[t]}, {ρ31[t], ρ32[t], ρ33[t]}};
ρprime = -I (h2.ρ - ρ.h2) + {{γ31 ρ33[t] + γ21 ρ22[t], -(1/2) γ21 ρ12[t], -(1/2) (γ31 + γ32) ρ13[t]}, {-(1/2) γ21 ρ21[t], -γ21 ρ22[t] + γ32 ρ33[t], -(1/2) (γ21 + γ31 + γ32) ρ23[t]}, {-(1/2) (γ31 + γ32) ρ31[t], -(1/2) (γ21 + γ31 + γ32) ρ32[t], -ρ33[t] (γ31 + γ32)}};
replace3 = {Δ1 -> ( 2 π)/(500*10^-9)*10^3, Δ2 -> ( 2 π)/(500*10^-9)*10^3, γ21 -> 1/(16*10^-9), γ31 -> 1/(16*10^-9), γ32 -> 1/(16*10^-9), Ω1 -> 10^9,Ω2 -> 10^9, k1 -> ( 2 π)/(500*10^-9), k2 -> ( 2 π)/(500*10^-9)};
var = Flatten@ρ;
{eq, ic} = {D[var, t] == Flatten@ρprime // Thread,
var == {1, 0, 0, 0, 0, 0, 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;
Thanks for the help.
Simplify. The rest terminates after half a minute. – Henrik Schumacher Sep 26 '19 at 04:52Δ1and no rule forΔ2insidereplace3, is this intended or a typo? – xzczd Oct 02 '19 at 13:44γ21,γ31,γ32, but no rule forγ12, is this intended? – xzczd Oct 03 '19 at 06:24γ12, it should be aγ21. – Caleb Horwitz Oct 03 '19 at 17:07