Mathematica Mathematica Plot Real Portion (Contour Plot)

Click For Summary
In Mathematica, the user seeks to plot the real part of the variable σ in a contour plot, as the current implementation may yield complex values. The discussion highlights that while σ is a plotting variable, some values can have non-zero imaginary components, complicating the plotting of its real part. A simpler example is proposed to clarify the issue, involving the quadratic equation y^2 - xy + 1 = 0, where the user successfully plots Re(y) using the quadratic formula. However, they express difficulty in applying a similar approach to more complex equations where an explicit solution for the independent variable cannot be obtained. The user seeks guidance on how to implicitly plot the real component of y for given x values.
member 428835
Hi PF!

In Mathematica and given the code below, I am trying to the real part of ##\sigma##, ##Re(\sigma)##, in stead of simply ##\sigma##. Any help would be awesome! Here's what I have:
Code:
n = 3;
ContourPlot[(\[Sigma]^2 -
      2 (n - 1) (2 n + 1) \[Epsilon] \[Sigma] + (n - 1) n (n + 2)) ((
      Sqrt[\[Sigma]/\[Epsilon]]
        BesselJ[n + 1/2, Sqrt[\[Sigma]/\[Epsilon]]])/
      BesselJ[n + 3/2, Sqrt[\[Sigma]/\[Epsilon]]] - 2) +
   4 (n - 1)^2 (n + 1) \[Epsilon] \[Sigma] == 0, {\[Epsilon], 0,
  1.5}, {\[Sigma], 0, 7}]
 
Last edited by a moderator:
Physics news on Phys.org
If no one knows this, does anyone know how I can get a numerical solution for sigma as a function of epsilon values for integers n=2,3,4,5,6?
 
joshmccraney said:
In Mathematica and given the code below, I am trying to the real part of ##\sigma##, ##Re(\sigma)##, in stead of simply ##\sigma##.
I don't understand what you mean. σ is one of the plotting variable, so I don't see why ot wouldn't be real.
 
DrClaude said:
I don't understand what you mean. σ is one of the plotting variable, so I don't see why ot wouldn't be real.
For all ##\epsilon\in(0,1.5)## there are associated ##\sigma## values, some of which have non-zero imaginary components. Something like ##y=1+\sqrt{x+1}:x\in(-2,2)##. I would like to plot the real component of ##y## for listed values of ##x##, but obviously for the more difficult problem in post 1 (as opposed to this toy problem).

Thanks for taking an interest!
 
Sorry, but I'm still having problems understanding. Would you mind explaining it in mathematical terms first? What is the relation between σ and ε and what is the function you want to plot?
 
Sorry for being unclear. I'll reduce this problem to a much simpler one, which I think will make much more sense, and if you can answer it then you've answered my initial question. Consider the problem
$$ y^2 - x y + 1 = 0$$

I am trying to plot ##Re(y)## given a set of ##x## values in ##[0,1.5]##. One way to do this is use the quadratic formula and explicitly plot $$Re(y) = Re\left(\frac{x\pm\sqrt{x^2-4}}{2}\right)$$ This is shown in the attached pdf as "correctplot". Notice the linear region from the origin corresponds to solutions of ##y## whose imaginary components are non-zero.

The method above gives the correct plot, but I had to solve for ##y## explicitly. However, since I can't solve for the independent variable explicitly in more complicated equations (such as that in post 1), I am unsure how to implicitly plot the real component of ##y## for given ##x## values. The attached pdf "incorrectplot" plots ##y^2 - x y + 1 = 0## via ContourPlot. Notice the linear portion is not shown.

Any idea how to plot ##Re(y)## implicitly for any value of ##x##?
 

Attachments

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 0 ·
Replies
0
Views
2K