1
$\begingroup$
α2 = 1/2 (κ2 + 2 η2) + I (δ0 - β2 I2);
α1 = 1/2 (κ1 - 2 η1) + I (δ0 - β1 I1);

I would like to plot a cross-section for different values of δ2 but could get the output, any comments would be greatly appreciated.

I2 = x*10^12;
I1 = y*10^12;

P = (h ν2a)/(2 κ2a) I2 Abs[α2]^2;

ListPlot[{Table[{(P /. δ2 -> 4 π)*10^12, I2/10^10}, {x, 0, 
    0.1, 0.0001}], 
  Table[{(P /. δ2 -> 0)*10^12, I2/10^10}, {x, 0, 0.1, 0.0001}],
   Table[{(P /. δ2 -> 6 π)*10^12, I2/10^10}, {x, 0, 0.1, 
    0.0001}]}, PlotRange -> {{0, 0.042}, {0, 1.8}}, Frame -> True, 
 FrameLabel -> {"P(pW)", 
   "\!\(\*SubscriptBox[\(I\), \
\(2\)]\)\[Cross]\!\(\*SuperscriptBox[\(10\), \(12\)]\)"}, 
 FrameStyle -> Directive[19, Black], Joined -> True,
 AspectRatio -> 1.3, ImageSize -> 250, 
 PlotStyle -> {{Black, Thick, DotDashed}, {Blue, Thick, Dashed}, {Red,
     Thick}}, ImageSize -> 300]
$\endgroup$
4
  • $\begingroup$ Please find a short, simple example of your problem, if possible. $\endgroup$
    – C. E.
    Commented Dec 23, 2016 at 9:57
  • $\begingroup$ @– C. E, the code takes few seconds to run $\endgroup$
    – user0322
    Commented Dec 23, 2016 at 10:12
  • 2
    $\begingroup$ I ran it but it produced a blank plot, and now I have to read to code to understand what you were trying to do. I still haven't looked at it, but in my experience it usually boils down to something I've seen before. It is always appreciated when people simplify problems as much as possible (without all the constants etc.) because then one can often spot what the problem is without much effort at all. And then someone is more likely to help. Maybe it's not possible for this problem. $\endgroup$
    – C. E.
    Commented Dec 23, 2016 at 10:29
  • $\begingroup$ @– C. E. yeah, I even got the a blank plot $\endgroup$
    – user0322
    Commented Dec 23, 2016 at 10:30

2 Answers 2

1
$\begingroup$

If you look at P you will see it is a list instead of a scalar. At some point in its definition something has returned as a list and this has made its way through P.

You could First P, First@P /. δ2 -> 4 π , wherever it is used. This will get you the ListPlot; you could just Plot it instead of all the Table bits. However, you should probably work through its definition to find out how it became a list as there could be other issues as a result.

Hope this helps.

$\endgroup$
16
  • 1
    $\begingroup$ Win by seconds :). You can also use P = First[(h ν2a)/(2 κ2a) I2 Abs[α2]^2]; $\endgroup$
    – Sumit
    Commented Dec 23, 2016 at 10:51
  • $\begingroup$ @Sumit Whoops, I ment First. LOL $\endgroup$
    – Edmund
    Commented Dec 23, 2016 at 10:53
  • $\begingroup$ @Sumit & Edmund, It works perfectly with what I was looking for!!! $\endgroup$
    – user0322
    Commented Dec 23, 2016 at 12:37
  • $\begingroup$ @Sumit, there is a fellow up question: If I now modify the δ1 and δ2 equal to δ0 and I1 = I2 Abs[Conjugate[[Alpha]2] + [Mu] [Eta]3]^2/ Abs[[Mu] (-I [Delta]0 + [Kappa]1/2 - [Eta]1) - [Eta]7]^2 with P = 0.8 P1 and the new parameter [Mu]=0.1. $\endgroup$
    – user0322
    Commented Jan 10, 2017 at 6:33
  • $\begingroup$ @DavidH, ummm, what is the problem? $\endgroup$
    – Sumit
    Commented Jan 10, 2017 at 9:20
0
$\begingroup$

Other way to fix that is:

 ListPlot[{
 Map[Flatten, Table[{(P /. \[Delta]2 -> 4 \[Pi])*10^12, I2/10^10}, {x, 0, 0.1, 0.0001}]],
 Map[Flatten, Table[{(P /. \[Delta]2 -> 0)*10^12, I2/10^10}, {x, 0, 0.1, 0.0001}]],
 Map[Flatten, Table[{(P /. \[Delta]2 -> 6 \[Pi])*10^12, I2/10^10}, {x, 0, 0.1, 0.0001}]]},
 PlotRange -> {{0, 0.042}, {0, 1.8}},
 Frame -> True, FrameLabel -> {"P(pW)", "\!\(\*SubscriptBox[\(I\), \
\(2\)]\)\[Cross]\!\(\*SuperscriptBox[\(10\), \(12\)]\)"},
 FrameStyle -> Directive[19, Black], Joined -> True, AspectRatio -> 1.3, ImageSize -> 250,
 PlotStyle -> {{Black, Thick, DotDashed}, {Blue, Thick, Dashed}, {Red, Thick}}, ImageSize -> 300]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.