Mathematica - Countour plot problem

In summary, the conversation is about trying to plot eigenfunctions in Mathematica for a semicircle. The function is given by ##g_{ms} = J_{2m+1}(y_{ms}x) sin ((2m+1)\varphi)## and an example is provided for m=0 and s=1. The person is struggling with getting the correct result and has shared the code they have written so far, along with a plot they are getting that is not correct. They are wondering if they are using the wrong coordinates and if they should try using polar form instead.
  • #1
asynja
16
0
Hello! I'm trying to plot some eigenfunctions (for a semicircle) in Mathematica. Functions are of the following form:
$$g_{ms}=J_{2m+1}(y_{ms}x) sin ((2m+1)\varphi)$$
For example, for m=0 and s=1 it should look like what I drew in the attached file "Snapshot". Well, I don't have much experience with Mathematica and the "code" I wrote so far doesn't give me the right result.
Here's my try:
Matlab:
m = 0;
s = 1;
dat = Table[{x = RandomReal[{-1, 1}], y = RandomReal[{0, 1}],
    BesselJ[(2*m + 1), BesselJZero[m, s]*x]*
     Sin[(2*m + 1)*ArcTan[x, y]]}, {1000}];
ListContourPlot[dat]
The plot I get is in the attached file "Wrongplot". What am I doing wrong?
 

Attachments

  • Snapshot.jpg
    Snapshot.jpg
    8.5 KB · Views: 425
  • WrongPlot.png
    WrongPlot.png
    6 KB · Views: 524
Last edited by a moderator:
Physics news on Phys.org
  • #2
It seems like you might be using the wrong coordinates. Could this be the polar form?
Where you have x in ##g_{ms} = J_{2m+1}(y_{ms} x) \sin ((2m+1)\varphi)##, you might try using r = ##\sqrt(x^2+y^2)##.
 

1. What is Mathematica and what is a contour plot?

Mathematica is a software program used for mathematical and scientific computations, data analysis, and visualization. A contour plot is a graphical representation of the variation of a function over a two-dimensional plane, with the contours indicating points where the function has a constant value.

2. How do I create a contour plot in Mathematica?

To create a contour plot in Mathematica, you can use the ContourPlot function. This function takes in the mathematical expression or function you want to plot, as well as the range of values for the x and y variables. You can also specify the number of contours and the color scheme for the plot.

3. Why am I getting an empty contour plot in Mathematica?

If your contour plot is empty, it could be due to several reasons. Make sure that your mathematical expression is written correctly and that the range of values for the x and y variables is appropriate. If the range is too small, the contours may not be visible. You can also try adjusting the number of contours or the color scheme to make the plot more visible.

4. Can I customize the appearance of my contour plot in Mathematica?

Yes, you can customize the appearance of your contour plot in Mathematica. You can change the color scheme, the number of contours, and the range of values for the x and y variables. You can also add labels, titles, and legends to your plot to make it more informative.

5. Is it possible to overlay multiple contour plots in Mathematica?

Yes, it is possible to overlay multiple contour plots in Mathematica. You can use the Show function to combine multiple contour plots into one. Make sure that the functions you are plotting have the same range of values for the x and y variables to create an accurate overlay.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
898
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
997
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
3K
Back
Top