Mathematica - Countour plot problem

  • Context: Mathematica 
  • Thread starter Thread starter asynja
  • Start date Start date
  • Tags Tags
    Mathematica Plot
Click For Summary
SUMMARY

The discussion focuses on generating contour plots of eigenfunctions for a semicircle using Mathematica. The user attempts to plot the function $$g_{ms}=J_{2m+1}(y_{ms}x) \sin ((2m+1)\varphi)$$ but encounters issues with the output. The suggested solution involves converting Cartesian coordinates to polar coordinates by using \( r = \sqrt{x^2+y^2} \) to achieve the correct plot representation.

PREREQUISITES
  • Familiarity with Mathematica version 12.0 or later
  • Understanding of Bessel functions, specifically BesselJ
  • Knowledge of polar coordinates and their conversion from Cartesian coordinates
  • Basic experience with contour plotting techniques in Mathematica
NEXT STEPS
  • Explore Mathematica's ListContourPlot function for advanced plotting techniques
  • Study the properties and applications of Bessel functions in mathematical modeling
  • Learn about coordinate transformations, particularly from Cartesian to polar coordinates
  • Investigate examples of eigenfunction plots in Mathematica for better understanding
USEFUL FOR

Mathematicians, physicists, and students working with eigenfunctions and contour plots in Mathematica, as well as anyone interested in visualizing complex mathematical functions.

asynja
Messages
15
Reaction score
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: 496
  • WrongPlot.png
    WrongPlot.png
    6 KB · Views: 616
Last edited by a moderator:
Physics news on Phys.org
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)##.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K