0
$\begingroup$

I want to plot the piecewise function (FP), which is define as:

$$FP=\cases{1,&$\text{Eta}<J$\\ \frac{1-\left| \text{Gam}\right| }{2}, &$\text{Eta}=J$\\ \frac{\left| \text{Gam}*J\right| }{\text{Eta}}, &$\text{Eta}>J$\\}$$

where $J=1$, $\text{Gam}=\frac{8}{10}$, and $\text{Eta}=\sqrt{B^2+\text{Gam}^2 J^2}$ According to the ref. "10.1103/PhysRevLett.88.107901" I already know that the resulting curve should be as shown in Fig. (a). But I get Fig. (b).

enter image description here

The code I used is:

J = 1; Gam = 8/10; 
Eta = Sqrt[B^2 + J^2 Gam^2];
FP = Piecewise[{{1, Eta < J}, {(1 - Abs[Gam])/2, 
     Eta == J}, {(Abs[J Gam])/Eta, Eta > J}}] ;
Plot[FP, {B, 0, 3}, Exclusions -> None]

Did I miss something?

$\endgroup$
2
  • $\begingroup$ Just from simple algebra, it seems clear to me that the first graph (Fig. (a)) does not match the formula. Note that Plot will not plot isolated points. Those have to be added by the user. The option Epilog is a common way to do that. $\endgroup$ – Michael E2 Aug 7 '20 at 17:44
  • $\begingroup$ Maybe you want something like ListLinePlot@Table[FP, {B, 0, 3, 1/100}]. It looks close to Fig. (a), but mathematically, it's inaccurate. $\endgroup$ – Michael E2 Aug 7 '20 at 17:48
2
$\begingroup$

Maybe you want this?:

Plot[FP, {B, 0, 3}, Exclusions -> None, 
 PlotPoints -> {Automatic, {0.6}}]

enter image description here

Or more generally,

excl = Values@Solve[And @@ # && 0 < B < 3, B] & /@ 
     Visualization`ExpandExclusions[FP, {B}, Automatic] //
    Flatten // 
   Union;
Plot[FP, {B, 0, 3}, Exclusions -> None, 
 PlotPoints -> {Automatic, excl}]
$\endgroup$

Your Answer

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

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