0
$\begingroup$

In the following code, if the matrix "n = (-I*(m1)) + (m2)" in the differential equation contains only the matrix "m1", I will get the answer, but if the matrix "n" is the sum of the two matrices "m1" and "m2", it will not answer. why? Please advise

Ω0 = 2 π*10*10^6; Γ = 
2 π*22*10^3; t0 = (Pi Sqrt[2]/(Ω0)); T = (7.2/2)*
t0; σ = T/6; tf = T;
FSR = (2 Pi*10^7);
s[t_] := 0.5 (1 + Tanh[(t - (T/2))/σ]);
ali[t_] := Sech[(t - (T/2))/σ];
WP[t_] := Ω0 (1/(Sqrt[2])) ali[t] Sin[Pi (s[t])/2];
WS[t_] := Ω0 (1/(Sqrt[2])) ali[t] Cos[Pi (s[t])/2];


m = {{0, WP[t], WP[t], WP[t], 0}, {WP[t], -FSR, 0, 0, -WS[t]}, {WP[t],
     0, 0, 0, WS[t]}, {WP[t], 0, 0, FSR, -WS[t]}, {0, -WS[t], 
     WS[t], -WS[t], 0}};

 q = Eigenvectors[m];
qq1 = Normalize[q[[1]]];
qq2 = Normalize[q[[2]]];
qq3 = Normalize[q[[3]]];
qq4 = Normalize[q[[4]]];
qq5 = Normalize[q[[5]]];

Ali1 = {{D[qq1, t][[1]], 0, 0, 0, 0}, {D[qq1, t][[2]], 0, 0, 0, 
   0}, {D[qq1, t][[3]], 0, 0, 0, 0}, {D[qq1, t][[4]], 0, 0, 0, 
   0}, {D[qq1, t][[5]], 0, 0, 0, 0}};
Vali1 = ConjugateTranspose[Ali1];
Kazi1 = Ali1.Vali1;

 Ali2 = {{D[qq2, t][[1]], 0, 0, 0, 0}, {D[qq2, t][[2]], 0, 0, 0, 
  0}, {D[qq2, t][[3]], 0, 0, 0, 0}, {D[qq2, t][[4]], 0, 0, 0, 
  0}, {D[qq2, t][[5]], 0, 0, 0, 0}};
Vali2 = ConjugateTranspose[Ali2];
Kazi2 = Ali2.Vali2;

Ali3 = {{D[qq3, t][[1]], 0, 0, 0, 0}, {D[qq3, t][[2]], 0, 0, 0, 
0}, {D[qq3, t][[3]], 0, 0, 0, 0}, {D[qq3, t][[4]], 0, 0, 0, 
0}, {D[qq3, t][[5]], 0, 0, 0, 0}};
Vali3 = ConjugateTranspose[Ali3];
Kazi3 = Ali3.Vali3;

Ali4 = {{D[qq4, t][[1]], 0, 0, 0, 0}, {D[qq4, t][[2]], 0, 0, 0, 
0}, {D[qq4, t][[3]], 0, 0, 0, 0}, {D[qq4, t][[4]], 0, 0, 0, 
0}, {D[qq4, t][[5]], 0, 0, 0, 0}};
Vali4 = ConjugateTranspose[Ali4];
Kazi4 = Ali4.Vali4;

 Ali5 = {{D[qq5, t][[1]], 0, 0, 0, 0}, {D[qq5, t][[2]], 0, 0, 0, 
   0}, {D[qq5, t][[3]], 0, 0, 0, 0}, {D[qq5, t][[4]], 0, 0, 0, 
   0}, {D[qq5, t][[5]], 0, 0, 0, 0}};
 Vali5 = ConjugateTranspose[Ali5];
Kazi5 = Ali5.Vali5;


 m1 = {{0, WP[t], WP[t], WP[t], 
0}, {WP[t], -FSR - I (Γ/2), 0, 0, -WS[t]}, {WP[t], 
0, -I (Γ/2), 0, WS[t]}, {WP[t], 0, 0, 
FSR - I (Γ/2), -WS[t]}, {0, -WS[t], WS[t], -WS[t], 
0}};


  m2 = Kazi1 + Kazi2 + Kazi3 + Kazi4 + Kazi5;

 n = (-I*(m1)) + (m2);

 sol1 = NDSolve[{D[c[t], t] == (n).c[t],
 c[0] == {1, 0, 0, 0, 0}}, c, {t, 0, 2 tf}];

 ans = Evaluate[c[t] /. sol1[[1]]][[5]];
 ans1 = Abs[ans]^2;
 Plot[ans1, {t, 0, 2 tf}, Frame -> True]    

In the following code, if the matrix "n = (-I*(m1)) + (m2)" in the differential equation contains only the matrix "m1", I will get the answer, but if the matrix "n" is the sum of the two matrices "m1" and "m2", it will not answer. why? Please advise. How tosolve this problem??

$\endgroup$
  • 1
    $\begingroup$ Maybe it's because m2 is an extremely complex 5x5 matrix with LeafCount 15303452. LeafCount[sol1] will not even complete. You should explain where this problem comes from, ideally with some background info and LaTeX equations. $\endgroup$ – flinty Sep 16 at 17:32
  • $\begingroup$ Thank you, yes m2 is an complex matrix. How to solve this problem? $\endgroup$ – Mojtaba Rezaee Sep 16 at 18:15
  • $\begingroup$ You cannot solve it like this. If you provided information about where the code comes from or what real world problem it solves then it might be possible write it differently that avoids the hugely complex matrices, but until then it is completely intractable. $\endgroup$ – flinty Sep 16 at 22:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.