Message Boards Message Boards

GROUPS:

Empty plot from ListDensityPlot3D of ParametricNDSolve solutions?

Posted 9 months ago
1273 Views
|
10 Replies
|
3 Total Likes
|

I am trying to visualize a function which depends upon 3 parameters and I am using listdensityplot3d where as n1sol, n2sol..... are the solution of coupled differential equations which I got using the command ParametricNDSolve, problem is there is no plot coming up after the compilation, can someone help me in this regard

n1sol[\[Epsilon]_, \[Tau]_, t_] :=
n1[\[Epsilon], \[Tau]][t] /. solA[[1]]; 
n2sol[\[Epsilon]_, \[Tau]_, t_] := 
n2[\[Epsilon], \[Tau]][t] /. solA[[2]];
mssol[\[Epsilon]_, \[Tau]_, t_] := 
ms[\[Epsilon], \[Tau]][t] /. solA[[3]]; 
msssol[\[Epsilon]_, \[Tau]_, t_] := 
mss[\[Epsilon], \[Tau]][t] /. solA[[4]]; 
m1sol[\[Epsilon]_, \[Tau]_, t_] := 
m1[\[Epsilon], \[Tau]][t] /. solB[[1]];  
m2sol[\[Epsilon]_, \[Tau]_, t_] :=  
m2[\[Epsilon], \[Tau]][t] /. solB[[2]]; 
mcsol[\[Epsilon]_, \[Tau]_, t_] := 
mc[\[Epsilon], \[Tau]][t] /. solB[[3]];

Vt = ( {
   {n1sol[\[Epsilon], \[Tau]][t] + 0.5, -m1sol[\[Epsilon], \[Tau]][t],
     mssol[\[Epsilon], \[Tau]][t], -mcsol[\[Epsilon], \[Tau]][t]},
   {-Conjugate[m1sol[\[Epsilon], \[Tau]][t]], 
    n1sol[\[Epsilon], \[Tau]][t] + 
     0.5, -Conjugate[mcsol[\[Epsilon], \[Tau]][t]], 
    Conjugate[mssol[\[Epsilon], \[Tau]][t]]},
   {Conjugate[
     mssol[\[Epsilon], \[Tau]][t]], -mcsol[\[Epsilon], \[Tau]][t], 
    n2sol[\[Epsilon], \[Tau]][t] + 0.5, -m2sol[\[Epsilon], \[Tau]][t]},
   {-Conjugate[mcsol[\[Epsilon], \[Tau]][t]], 
    mssol[\[Epsilon], \[Tau]][
     t], -Conjugate[m2sol[\[Epsilon], \[Tau]][t]], 
    n2sol[\[Epsilon], \[Tau]][t] + 0.5}
  } ); 
Vtq = Chop[(Vt + Vt\[Transpose])/2];
Aq = Evaluate[Vtq[[1 ;; 2, 1 ;; 2]]];
Bq = Vtq[[3 ;; 4, 3 ;; 4]];
Cq = Vtq[[1 ;; 2, 3 ;; 4]];
sigma = Det[Aq] + Det[Bq] - 2 Det[Cq];
\[Xi] = Evaluate[Sqrt[(sigma - Sqrt[sigma^2 - 4*Det[Vtq]])/2]];
Eme[\[Epsilon]_, \[Tau]_, t_] = Max[0, -Log2[2 \[Xi]]];
data = Table[
   Eme[\[Epsilon], \[Tau], t], {\[Tau], 0, 0.45, 0.1}, {\[Epsilon], 0,
     0.45, 0.1}, {t, 0, 2}];
ListDensityPlot3D[data]
POSTED BY: Danish Hamza
10 Replies
Posted 9 months ago

There are a bunch of undefined symbols in the code you provided. So the data you're passing to the plot cannot be evaluated to numerical values. Is there more code that you haven't provided?

For example, solA and solB are undefined. The expression m1sol[0., 0.] is undefined. In a Mathematica notebook, undefined symbols are styled as blue text.

If this is the whole code, then you need to go looking for the undefined symbols and give them definitions. If there is more code, then we'd need to see that before we can figure out what the problem is.

POSTED BY: Eric Rimbey
Posted 9 months ago

Yeah this is not the complete code let me upload it here everything is defined

Clear["Global`*"]
l = 0; \[Mu] = 1;
\[Eta] = 1;
\[Tau]f = 0.45;
\[Epsilon]f = 0.45;
d1 = 1/(4 \[Mu]^2 (1 - 2 \[Tau])) + (1 - 2 \[Tau])/4;  d2 = 
 1/(4 \[Mu]^2 (1 - 2 \[Tau])) - (1 - 2 \[Tau])/4;
c1 = 1/(4 \[Eta]^2 (1 - 2 \[Epsilon])) + (1 - 2 \[Epsilon])/4;  c2 = 
 1/(4 \[Eta]^2 (1 - 2 \[Epsilon])) - (1 - 2 \[Epsilon])/4;
ra = 22; \[Phi] = 0; g = 43; \[Gamma] = 20; \[Lambda] = .3*\[Gamma]; 
 \[Kappa]0 = 20; \[Theta] = 0; tf = 2;

\[CapitalOmega] = 550;
G = 101.7; \[CapitalDelta]1 = 4*\[Lambda] ;
\[CapitalDelta]2 =   -4*\[Lambda]; \[Alpha]11 = 0; \[Alpha]22 = 0; \
\[Alpha]11b = 0; \[Alpha]22b = 0;
\[Tau]min = 0.2; wmax = 0.05; wstep = 0.45;
\[Alpha]12 = 2*I*G*\[Gamma]/\[CapitalOmega];
\[Alpha]21 = 2*I*G*\[Gamma]/\[CapitalOmega];
\[Alpha]12b = -2*I*G*\[Gamma]/\[CapitalOmega];
\[Alpha]21b = -2*I*G*\[Gamma]/\[CapitalOmega];
ss1 = (\[Kappa]0*\[Lambda]*\[CapitalDelta]1)/(\[Lambda]^2 + \
\[CapitalDelta]1^2) (1 - 
      E^(-\[Lambda]*
        t) (Cos[\[CapitalDelta]1*t] + \[Lambda]/\[CapitalDelta]1*
          Sin[\[CapitalDelta]1*t])) - (\[Kappa]0^2*\[Lambda]^2*
     E^(-\[Lambda]*t))/(
    2 (\[Lambda]^2 + \[CapitalDelta]1^2)^3) ((1 - (
         3*\[Lambda]^2)/\[CapitalDelta]1^2) (E^(\[Lambda]*t) - 
         E^(-\[Lambda]*t)*Cos[2*\[CapitalDelta]1*t]) - 
      2 (1 - \[Lambda]^4/\[CapitalDelta]1^4) \[CapitalDelta]1*t*
       Sin[\[CapitalDelta]1*t] + 
      4 (1 + \[Lambda]^2/\[CapitalDelta]1^2)*\[Lambda]*t*
       Cos[\[CapitalDelta]1*
         t] - \[Lambda]/\[CapitalDelta]1 (3 - \[Lambda]^2/\
\[CapitalDelta]1^2)*E^(-\[Lambda]*t)*Sin[2*\[CapitalDelta]1*t]);
ss2 = (\[Kappa]0*\[Lambda]*\[CapitalDelta]2)/(\[Lambda]^2 + \
\[CapitalDelta]2^2) (1 - 
      E^(-\[Lambda]*
        t) (Cos[\[CapitalDelta]2*t] + \[Lambda]/\[CapitalDelta]2*
          Sin[\[CapitalDelta]2*t])) - (\[Kappa]0^2*\[Lambda]^2*
     E^(-\[Lambda]*t))/(
    2 (\[Lambda]^2 + \[CapitalDelta]2^2)^3) ((1 - (
         3*\[Lambda]^2)/\[CapitalDelta]2^2) (E^(\[Lambda]*t) - 
         E^(-\[Lambda]*t)*Cos[2*\[CapitalDelta]2*t]) - 
      2 (1 - \[Lambda]^4/\[CapitalDelta]2^4) \[CapitalDelta]2*t*
       Sin[\[CapitalDelta]2*t] + 
      4 (1 + \[Lambda]^2/\[CapitalDelta]2^2)*\[Lambda]*t*
       Cos[\[CapitalDelta]2*
         t] - \[Lambda]/\[CapitalDelta]2 (3 - \[Lambda]^2/\
\[CapitalDelta]2^2)*E^(-\[Lambda]*t)*Sin[2*\[CapitalDelta]2*t]);
\[Kappa]\[Kappa]1 = (\[Kappa]0*\[Lambda]^2)/(\[Lambda]^2 + \
\[CapitalDelta]1^2) (1 - 
      E^(-\[Lambda]*
        t) (Cos[\[CapitalDelta]1*t] - \[CapitalDelta]1/\[Lambda]*
          Sin[\[CapitalDelta]1*t])) + (\[Kappa]0^2*\[Lambda]^5*
     E^(-\[Lambda]*t))/(
    2 (\[Lambda]^2 + \[CapitalDelta]1^2)^3) ((1 - (
         3*\[CapitalDelta]1^2)/\[Lambda]^2) (E^(\[Lambda]*t) - 
         E^(-\[Lambda]*t)*Cos[2*\[CapitalDelta]1*t]) - 
      2 (1 - \[CapitalDelta]1^4/\[Lambda]^4) \[Lambda]*t*
       Cos[\[CapitalDelta]1*t] + 
      4 (1 + \[Lambda]^2/\[CapitalDelta]1^2)*\[CapitalDelta]1*t*
       Sin[\[CapitalDelta]1*
         t] + \[CapitalDelta]1/\[Lambda] (3 - \[CapitalDelta]1^2/\
\[Lambda]^2)*E^(-\[Lambda]*t)*Sin[2*\[CapitalDelta]1*t]);
\[Kappa]\[Kappa]2 = (\[Kappa]0*\[Lambda]^2)/(\[Lambda]^2 + \
\[CapitalDelta]2^2) (1 - 
      E^(-\[Lambda]*
        t) (Cos[\[CapitalDelta]2*t] - \[CapitalDelta]2/\[Lambda]*
          Sin[\[CapitalDelta]2*t])) + (\[Kappa]0^2*\[Lambda]^5*
     E^(-\[Lambda]*t))/(
    2 (\[Lambda]^2 + \[CapitalDelta]2^2)^3) ((1 - (
         3*\[CapitalDelta]2^2)/\[Lambda]^2) (E^(\[Lambda]*t) - 
         E^(-\[Lambda]*t)*Cos[2*\[CapitalDelta]2*t]) - 
      2 (1 - \[CapitalDelta]2^4/\[Lambda]^4) \[Lambda]*t*
       Cos[\[CapitalDelta]2*t] + 
      4 (1 + \[Lambda]^2/\[CapitalDelta]2^2)*\[CapitalDelta]2*t*
       Sin[\[CapitalDelta]2*
         t] + \[CapitalDelta]2/\[Lambda] (3 - \[CapitalDelta]2^2/\
\[Lambda]^2)*E^(-\[Lambda]*t)*Sin[2*\[CapitalDelta]2*t]);
s1 = Simplify[ss1]; s2 = Simplify[ss2]; \[Kappa]1 = 
 Simplify[\[Kappa]\[Kappa]1]; \[Kappa]2 = Simplify[\[Kappa]\[Kappa]2];
solA = ParametricNDSolve[{n1'[
      t] == (1/2) (\[Alpha]11 + \[Alpha]11b - 4 \[Kappa]1)*
       n1[t] + (1/2) E^(I \[Phi]) \[Alpha]12b*
       ms[t] + (1/2) E^(-I \[Phi]) \[Alpha]12*mss[t] + 
      1/2*(\[Alpha]11 + \[Alpha]11b), 
    n2'[t] == (1/2) (\[Alpha]22 + \[Alpha]22b - (4 \[Kappa]2)) n2[
        t] + (1/2) E^(I \[Phi]) \[Alpha]21*
       ms[t] + (1/2) E^(-I \[Phi]) \[Alpha]21b*mss[t] + 
      1/2*(\[Alpha]22 + \[Alpha]22b), 
    ms'[t] == (1/2) E^(-I \[Phi]) \[Alpha]21b*
       n1[t] + (1/2) E^(-I \[Phi]) \[Alpha]12*
       n2[t] + (1/
         2) (\[Alpha]11 + \[Alpha]22b - (2 (\[Kappa]1 + \[Kappa]2)) - 
         I (s1 - s2))*
       ms[t] + (1/2) (\[Alpha]12 + \[Alpha]21b) E^(-I \[Phi]), 
    mss'[t] == (1/2) E^(I \[Phi]) \[Alpha]21*n1[t] + (1/2) E^(
       I \[Phi]) \[Alpha]12b*
       n2[t] + (1/
         2) (\[Alpha]11b + \[Alpha]22 - (2 (\[Kappa]1 + \[Kappa]2)) + 
         I (s1 - s2))*mss[t] + (1/2) (\[Alpha]12b + \[Alpha]21) E^(
       I \[Phi]), n1[0] == d1 - 0.5, n2[0] == c1 - 0.5 , ms[0] == 0, 
    mss[0] == 0}, {n1, n2, ms, mss}, {t, 0, tf}, {\[Epsilon], \[Tau]}];
solB = ParametricNDSolve[{m1'[
      t] ==  (\[Alpha]11 - I s1 - 2 \[Kappa]1)*m1[t] + 
      E^(-I \[Phi]) \[Alpha]12*mc[t], 
    m2'[t] == (\[Alpha]22 - I s2 - 2 \[Kappa]2) m2[t] + 
      E^(I \[Phi]) \[Alpha]21*mc[t], 
    mc'[t] == 
     1/2 E^(I \[Phi]) \[Alpha]21*m1[t] + 
      1/2 E^(-I \[Phi]) \[Alpha]12*m2[t] + 
      1/2 (\[Alpha]11 + \[Alpha]22 - 2 (\[Kappa]1 + \[Kappa]2) - 
         I (s1 - s2))*mc[t], m1[0] == -d2 , m2[0] == -c2 , 
    mc[0] == 0}, {m1, m2, mc}, {t, 0, tf}, {\[Epsilon], \[Tau]}];
n1sol[\[Epsilon]_, \[Tau]_, t_] := 
  n1[\[Epsilon], \[Tau]][t] /. solA[[1]]; 
n2sol[\[Epsilon]_, \[Tau]_, t_] := 
  n2[\[Epsilon], \[Tau]][t] /. solA[[2]];
 mssol[\[Epsilon]_, \[Tau]_, t_] := 
  ms[\[Epsilon], \[Tau]][t] /. solA[[3]]; 
msssol[\[Epsilon]_, \[Tau]_, t_] := 
  mss[\[Epsilon], \[Tau]][t] /. solA[[4]]; 
m1sol[\[Epsilon]_, \[Tau]_, t_] := 
  m1[\[Epsilon], \[Tau]][t] /. solB[[1]];  
m2sol[\[Epsilon]_, \[Tau]_, t_] :=  
  m2[\[Epsilon], \[Tau]][t] /. solB[[2]]; 
 mcsol[\[Epsilon]_, \[Tau]_, t_] := 
  mc[\[Epsilon], \[Tau]][t] /. solB[[3]];


Vt = ( {
    {n1sol[\[Epsilon], \[Tau]][t] + 
      0.5, -m1sol[\[Epsilon], \[Tau]][t], 
     mssol[\[Epsilon], \[Tau]][t], -mcsol[\[Epsilon], \[Tau]][t]},
    {-Conjugate[m1sol[\[Epsilon], \[Tau]][t]], 
     n1sol[\[Epsilon], \[Tau]][t] + 
      0.5, -Conjugate[mcsol[\[Epsilon], \[Tau]][t]], 
     Conjugate[mssol[\[Epsilon], \[Tau]][t]]},
    {Conjugate[
      mssol[\[Epsilon], \[Tau]][t]], -mcsol[\[Epsilon], \[Tau]][t], 
     n2sol[\[Epsilon], \[Tau]][t] + 
      0.5, -m2sol[\[Epsilon], \[Tau]][t]},
    {-Conjugate[mcsol[\[Epsilon], \[Tau]][t]], 
     mssol[\[Epsilon], \[Tau]][
      t], -Conjugate[m2sol[\[Epsilon], \[Tau]][t]], 
     n2sol[\[Epsilon], \[Tau]][t] + 0.5}
   } ); 
Vtq = Chop[(Vt + Vt\[Transpose])/2];
Aq = Evaluate[Vtq[[1 ;; 2, 1 ;; 2]]];
Bq = Vtq[[3 ;; 4, 3 ;; 4]];
Cq = Vtq[[1 ;; 2, 3 ;; 4]];
sigma = Det[Aq] + Det[Bq] - 2 Det[Cq];
\[Xi] = Evaluate[Sqrt[(sigma - Sqrt[sigma^2 - 4*Det[Vtq]])/2]];
Eme[\[Epsilon]_, \[Tau]_, t_] = Max[0, -Log2[2 \[Xi]]];
data = Table[
   Eme[\[Epsilon], \[Tau], t], {\[Tau], 0, 0.45, 0.1}, {\[Epsilon], 0,
     0.45, 0.1}, {t, 0, 2}];
ListDensityPlot3D[data]
POSTED BY: Danish Hamza
Posted 9 months ago

You can start looking from solA and solB in above code.

POSTED BY: Danish Hamza
Posted 9 months ago

You're still missing definitions. For example m1sol[0., 0.], there is no definition for that form. If you evaluate ??m1sol, you can see that it expects three input arguments. Also, if you just inspect data, you can see directly all of the expressions that haven't been reduced to numbers.

POSTED BY: Eric Rimbey
Posted 9 months ago

When i try to plot this function for two parameters "t, and \tau" and use the command plot3d everything works out perfect although the variables n1 n2 ms were blue until the parameters were given values , but when i introduce another parameter in the command parametricNDSolve "\Xi" it does not evaluate properly(variables are blue until parameters have values) can you give me any hint what is going wrong. I hope you can now understand what is the problem, it is not just the missing definitions.

POSTED BY: Danish Hamza
Posted 9 months ago

I have changed the syntax in the definition n1sol[\Epsilon,\Xi,t]=n1[\epsilon][\Xi][t] and so on and in the matrix vt as well. Now by inspecting the data Eme[[Epsilon], [Tau], t] = Max[0, -Log2[2 [Xi]]] for this function i m getting paramteric expression in the output but with an error Hold::fpct: -- Message text not found -- ({[Epsilon],[Tau]}) ({0.}).

POSTED BY: Danish Hamza
Posted 9 months ago

Well, it would be interesting to see the Plot3D example that worked for you. But regarding the example you asked about, I don't know how you expect it to work when data is so obviously malformed. Why don't you just work on providing the missing definitions or correcting the computations that produce the malformed data?

Here's a guess... Are you expecting solA = ParametricNDSolve[...] to actually assign values to n1, n2, ms, mss? If you are, then that's one source of problems. The result will actually be a list of rules. You will need to parse those rules if you want to use them to define values for those symbols.

POSTED BY: Eric Rimbey
Posted 9 months ago

Well let me share plot3d code with you which works perfectly, now in the same code lets put another paramter "\Xi" which I shared earlier and change it accordingly and use the command ListDesnityPlot3D it does not work....

Clear["Global`*"]
l = 0; \[Mu] = 1;
\[Eta] = 1;
\[Epsilon] = 0.1 ;
d1 = 1/(4 \[Mu]^2 (1 - 2 \[Tau])) + (1 - 2 \[Tau])/4;  d2 = 
 1/(4 \[Mu]^2 (1 - 2 \[Tau])) - (1 - 2 \[Tau])/4;
c1 = 1/(4 \[Eta]^2 (1 - 2 \[Epsilon])) + (1 - 2 \[Epsilon])/4;  c2 = 
 1/(4 \[Eta]^2 (1 - 2 \[Epsilon])) - (1 - 2 \[Epsilon])/4;

ra = 22; \[Phi] = 0; g = 43; \[Gamma] = 20; \[Lambda] = .3*\[Gamma]; 
 \[Kappa]0 = 20; \[Theta] = 0; tf = 2;

\[CapitalOmega] = 800;
G = 101.7; \[CapitalDelta]1 = 4*\[Lambda] ;
\[CapitalDelta]2 =   -4*\[Lambda]; \[Alpha]11 = 0; \[Alpha]22 = 0; \
\[Alpha]11b = 0; \[Alpha]22b = 0;
\[Tau]min = 0.2; wmax = 0.05; wstep = 0.45;
\[Alpha]12 = 2*I*G*\[Gamma]/\[CapitalOmega];
\[Alpha]21 = 2*I*G*\[Gamma]/\[CapitalOmega];
\[Alpha]12b = -2*I*G*\[Gamma]/\[CapitalOmega];
\[Alpha]21b = -2*I*G*\[Gamma]/\[CapitalOmega];
ss1 = (\[Kappa]0*\[Lambda]*\[CapitalDelta]1)/(\[Lambda]^2 + \
\[CapitalDelta]1^2) (1 - 
      E^(-\[Lambda]*
        t) (Cos[\[CapitalDelta]1*t] + \[Lambda]/\[CapitalDelta]1*
          Sin[\[CapitalDelta]1*t])) - (\[Kappa]0^2*\[Lambda]^2*
     E^(-\[Lambda]*t))/(
    2 (\[Lambda]^2 + \[CapitalDelta]1^2)^3) ((1 - (
         3*\[Lambda]^2)/\[CapitalDelta]1^2) (E^(\[Lambda]*t) - 
         E^(-\[Lambda]*t)*Cos[2*\[CapitalDelta]1*t]) - 
      2 (1 - \[Lambda]^4/\[CapitalDelta]1^4) \[CapitalDelta]1*t*
       Sin[\[CapitalDelta]1*t] + 
      4 (1 + \[Lambda]^2/\[CapitalDelta]1^2)*\[Lambda]*t*
       Cos[\[CapitalDelta]1*
         t] - \[Lambda]/\[CapitalDelta]1 (3 - \[Lambda]^2/\
\[CapitalDelta]1^2)*E^(-\[Lambda]*t)*Sin[2*\[CapitalDelta]1*t]);
ss2 = (\[Kappa]0*\[Lambda]*\[CapitalDelta]2)/(\[Lambda]^2 + \
\[CapitalDelta]2^2) (1 - 
      E^(-\[Lambda]*
        t) (Cos[\[CapitalDelta]2*t] + \[Lambda]/\[CapitalDelta]2*
          Sin[\[CapitalDelta]2*t])) - (\[Kappa]0^2*\[Lambda]^2*
     E^(-\[Lambda]*t))/(
    2 (\[Lambda]^2 + \[CapitalDelta]2^2)^3) ((1 - (
         3*\[Lambda]^2)/\[CapitalDelta]2^2) (E^(\[Lambda]*t) - 
         E^(-\[Lambda]*t)*Cos[2*\[CapitalDelta]2*t]) - 
      2 (1 - \[Lambda]^4/\[CapitalDelta]2^4) \[CapitalDelta]2*t*
       Sin[\[CapitalDelta]2*t] + 
      4 (1 + \[Lambda]^2/\[CapitalDelta]2^2)*\[Lambda]*t*
       Cos[\[CapitalDelta]2*
         t] - \[Lambda]/\[CapitalDelta]2 (3 - \[Lambda]^2/\
\[CapitalDelta]2^2)*E^(-\[Lambda]*t)*Sin[2*\[CapitalDelta]2*t]);
\[Kappa]\[Kappa]1 = (\[Kappa]0*\[Lambda]^2)/(\[Lambda]^2 + \
\[CapitalDelta]1^2) (1 - 
      E^(-\[Lambda]*
        t) (Cos[\[CapitalDelta]1*t] - \[CapitalDelta]1/\[Lambda]*
          Sin[\[CapitalDelta]1*t])) + (\[Kappa]0^2*\[Lambda]^5*
     E^(-\[Lambda]*t))/(
    2 (\[Lambda]^2 + \[CapitalDelta]1^2)^3) ((1 - (
         3*\[CapitalDelta]1^2)/\[Lambda]^2) (E^(\[Lambda]*t) - 
         E^(-\[Lambda]*t)*Cos[2*\[CapitalDelta]1*t]) - 
      2 (1 - \[CapitalDelta]1^4/\[Lambda]^4) \[Lambda]*t*
       Cos[\[CapitalDelta]1*t] + 
      4 (1 + \[Lambda]^2/\[CapitalDelta]1^2)*\[CapitalDelta]1*t*
       Sin[\[CapitalDelta]1*
         t] + \[CapitalDelta]1/\[Lambda] (3 - \[CapitalDelta]1^2/\
\[Lambda]^2)*E^(-\[Lambda]*t)*Sin[2*\[CapitalDelta]1*t]);
\[Kappa]\[Kappa]2 = (\[Kappa]0*\[Lambda]^2)/(\[Lambda]^2 + \
\[CapitalDelta]2^2) (1 - 
      E^(-\[Lambda]*
        t) (Cos[\[CapitalDelta]2*t] - \[CapitalDelta]2/\[Lambda]*
          Sin[\[CapitalDelta]2*t])) + (\[Kappa]0^2*\[Lambda]^5*
     E^(-\[Lambda]*t))/(
    2 (\[Lambda]^2 + \[CapitalDelta]2^2)^3) ((1 - (
         3*\[CapitalDelta]2^2)/\[Lambda]^2) (E^(\[Lambda]*t) - 
         E^(-\[Lambda]*t)*Cos[2*\[CapitalDelta]2*t]) - 
      2 (1 - \[CapitalDelta]2^4/\[Lambda]^4) \[Lambda]*t*
       Cos[\[CapitalDelta]2*t] + 
      4 (1 + \[Lambda]^2/\[CapitalDelta]2^2)*\[CapitalDelta]2*t*
       Sin[\[CapitalDelta]2*
         t] + \[CapitalDelta]2/\[Lambda] (3 - \[CapitalDelta]2^2/\
\[Lambda]^2)*E^(-\[Lambda]*t)*Sin[2*\[CapitalDelta]2*t]);
s1 = Simplify[ss1]; s2 = Simplify[ss2]; \[Kappa]1 = 
 Simplify[\[Kappa]\[Kappa]1]; \[Kappa]2 = Simplify[\[Kappa]\[Kappa]2];
solA = ParametricNDSolve[{n1'[
      t] == (1/2) (\[Alpha]11 + \[Alpha]11b - 4 \[Kappa]1)*
       n1[t] + (1/2) E^(I \[Phi]) \[Alpha]12b*
       ms[t] + (1/2) E^(-I \[Phi]) \[Alpha]12*mss[t] + 
      1/2*(\[Alpha]11 + \[Alpha]11b), 
    n2'[t] == (1/2) (\[Alpha]22 + \[Alpha]22b - (4 \[Kappa]2)) n2[
        t] + (1/2) E^(I \[Phi]) \[Alpha]21*
       ms[t] + (1/2) E^(-I \[Phi]) \[Alpha]21b*mss[t] + 
      1/2*(\[Alpha]22 + \[Alpha]22b), 
    ms'[t] == (1/2) E^(-I \[Phi]) \[Alpha]21b*
       n1[t] + (1/2) E^(-I \[Phi]) \[Alpha]12*
       n2[t] + (1/
         2) (\[Alpha]11 + \[Alpha]22b - (2 (\[Kappa]1 + \[Kappa]2)) - 
         I (s1 - s2))*
       ms[t] + (1/2) (\[Alpha]12 + \[Alpha]21b) E^(-I \[Phi]), 
    mss'[t] == (1/2) E^(I \[Phi]) \[Alpha]21*n1[t] + (1/2) E^(
       I \[Phi]) \[Alpha]12b*
       n2[t] + (1/
         2) (\[Alpha]11b + \[Alpha]22 - (2 (\[Kappa]1 + \[Kappa]2)) + 
         I (s1 - s2))*mss[t] + (1/2) (\[Alpha]12b + \[Alpha]21) E^(
       I \[Phi]), n1[0] == d1 - 0.5, n2[0] == c1 - 0.5 , ms[0] == 0, 
    mss[0] == 0}, {n1, n2, ms, mss}, {t, 0, tf}, {\[Tau]}];
solB = ParametricNDSolve[{m1'[
      t] ==  (\[Alpha]11 - I s1 - 2 \[Kappa]1)*m1[t] + 
      E^(-I \[Phi]) \[Alpha]12*mc[t], 
    m2'[t] == (\[Alpha]22 - I s2 - 2 \[Kappa]2) m2[t] + 
      E^(I \[Phi]) \[Alpha]21*mc[t], 
    mc'[t] == 
     1/2 E^(I \[Phi]) \[Alpha]21*m1[t] + 
      1/2 E^(-I \[Phi]) \[Alpha]12*m2[t] + 
      1/2 (\[Alpha]11 + \[Alpha]22 - 2 (\[Kappa]1 + \[Kappa]2) - 
         I (s1 - s2))*mc[t], m1[0] == -d2 , m2[0] == -c2 , 
    mc[0] == 0}, {m1, m2, mc}, {t, 0, tf}, {\[Tau]}];
n1sol[\[Tau]_, t_] := n1[\[Tau]][t] /. solA[[1]]; 
n2sol[\[Tau]_, t_] := n2[\[Tau]][t] /. solA[[2]];
 mssol[\[Tau]_, t_] := ms[\[Tau]][t] /. solA[[3]]; 
msssol[\[Tau]_, t_] := mss[\[Tau]][t] /. solA[[4]]; 
m1sol[\[Tau]_, t_] := m1[\[Tau]][t] /. solB[[1]];  
m2sol[\[Tau]_, t_] :=  m2[\[Tau]][t] /. solB[[2]]; 
 mcsol[\[Tau]_, t_] := mc[\[Tau]][t] /. solB[[3]];

 tr4 = ( {
    {1, 1, 0, 0},
    {-I, I, 0, 0},
    {0, 0, 1, 1},
    {0, 0, I, -I}
   } );(*Vtq=Chop[(Vt+Vt\[Transpose])/2];*)

Vt = ( {
    {n1sol[\[Tau], t] + 0.5, -m1sol[\[Tau], t], 
     mssol[\[Tau], t], -mcsol[\[Tau], t]},
    {-Conjugate[m1sol[\[Tau], t]], 
     n1sol[\[Tau], t] + 0.5, -Conjugate[mcsol[\[Tau], t]], 
     Conjugate[mssol[\[Tau], t]]},
    {Conjugate[mssol[\[Tau], t]], -mcsol[\[Tau], t], 
     n2sol[\[Tau], t] + 0.5, -m2sol[\[Tau], t]},
    {-Conjugate[mcsol[\[Tau], t]], 
     mssol[\[Tau], t], -Conjugate[m2sol[\[Tau], t]], 
     n2sol[\[Tau], t] + 0.5}
   } ); 
Vtq = Chop[(Vt + Vt\[Transpose])/2];
Aq = Evaluate[Vtq[[1 ;; 2, 1 ;; 2]]];
Bq = Vtq[[3 ;; 4, 3 ;; 4]];
Cq = Vtq[[1 ;; 2, 3 ;; 4]];
sigma = Det[Aq] + Det[Bq] - 2 Det[Cq];
\[Xi] = Evaluate[
   Sqrt[(sigma - Sqrt[sigma^2 - 4*Det[Vtq]])/
    2] /. {\[Tau] -> \[Tau]\[Tau], t -> tt}];
Eme[\[Tau]\[Tau]_, tt_] = Max[0, -Log2[2 \[Xi]]];
Plot3D[{Eme[\[Tau], t]}, {t, 0, tf}, {\[Tau], 0.45, 0}, 
 PlotRange -> Full, AxesLabel -> {Gt, \[Tau], EN}, 
 AxesStyle -> Directive[Black, 17], 
 ColorFunction -> ColorData["Aquamarine"], Background -> White, 
 AxesStyle -> Black, TicksStyle -> Black, Boxed -> False, 
 AxesEdge -> {{0, 0}, {1, 0}, {0, 0}}, ViewPoint -> {3, -2, 1.5} , 
 Mesh -> None, LabelStyle -> {FontSize -> 18,  Black, Bold}, 
 PlotLegends -> Automatic, PlotPoints -> {200, 50}, 
 TicksStyle -> Directive["Label", 30], Boxed -> True, 
 Ticks -> {{{0.5, 50}, {1, 100}, {1.5, 150}, {2, 200}}, {0.1, 0.2, 
    0.3, 0.4, 0.5 }, Automatic}, 
 FaceGrids -> {{-1, 0, 0}, {0, 0, -1}, {0, 1, 0}}, 
 FaceGridsStyle -> Directive[Dashed, Black]]
POSTED BY: Danish Hamza
Posted 9 months ago

I admit that I'm confused. I copy-pasted this code into a new notebook and executed it. I waited for over a minute, and it still hadn't finished. I aborted that and started poking around inspecting various pieces of your data. It still looks to me like things are still malformed. What exactly do you mean by "works perfectly"?

Maybe there's a version issue here. Maybe there's a copy-paste problem. I'm not going to try to figure out what the data should look like. I can tell you that, at least how it turns out on my computer, the data is just terribly malformed. We might be able to make better progress if you would do a bit of work on your side to inspect the data, highlight some examples of bad data, and ask questions about how to get what you want for those examples.

POSTED BY: Eric Rimbey
Posted 9 months ago

What i wanted to say was for plot3d command plot comes out as required.... but when i plug in the other parameter "\Xi" in paramtericNDsolve along with "\tau" and use ListDensityPlot3D plot is empty. Let me share file with you of Plot3D, run it and wait around 3 mnts. When you are sure let me know than we will move towards ListDensityPlot3D.

Attachments:
POSTED BY: Danish Hamza
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract