# Mathematica Mathematica Plot Real Portion (Contour Plot)

1. Jun 21, 2017

### joshmccraney

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 ( (Unknown Language)):

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: Jun 21, 2017
2. Jun 25, 2017

### joshmccraney

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?

3. Jun 26, 2017

### Staff: Mentor

I don't understand what you mean. σ is one of the plotting variable, so I don't see why ot wouldn't be real.

4. Jun 27, 2017

### joshmccraney

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!

5. Jun 28, 2017

### Staff: Mentor

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?

6. Jun 28, 2017

### joshmccraney

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$?

File size:
25 KB
Views:
40
File size:
15.9 KB
Views:
39