2
$\begingroup$

Let's say I have a dispersion relation $\omega=\exp{k}$, how should I write a mathematica code to ask for plots of $\omega$ against $k$ as well as the phase speed $\omega/k$ against $k$ for a range of $k\in(-10,10)$ and $\omega/k\in(-5,5)$?

I tried to write my code as follows:

ContourPlot[Dis==0,{k,-10,10},{\[Omega],-5k,5k}]

And this worked, a graph is plotted successfully. Here Dis is defined as Dis = $\omega-\exp{k}$.

However, when I try plotting phase speed against wavenumber, a graph cannot be plotted. My code is as follows

a=\[Omega]/k
ContourPlot[Dis==0,{k,-10,10},{a,-5,5}]

Could someone please let me know where went wrong please?

$\endgroup$
1
  • $\begingroup$ Why do you want to use "ContourPlot"? I think "Plot" will do: Plot[{Exp[k], Exp[k]/k}, {k, -10, 10}] $\endgroup$ Commented Oct 27, 2021 at 8:52

1 Answer 1

2
$\begingroup$
Clear[dis,reg];
dis = ω - E^k;
reg = ParametricRegion[{{k, a}, 
    dis == 0 && a == ω/k}, {{k, -10, 10}, ω, {a, -5, 
     5}}];
RegionPlot[reg, PlotRange -> {{-10, 10}, {-5, 5}}, 
 FrameLabel -> {"k", "a"}, LabelStyle -> Directive[Blue, Bold, 12]]
(*Region[reg]*)

enter image description here

We can also test another cases, for example:

dis = k*(ω^2 + ω) - E^k;

enter image description here

$\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.