1
$\begingroup$

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 by hand in the attached picture - something semicircular (sorry for bad drawing): r

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:

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 like this (see below). What am I doing wrong?

2

This is what I should get:

enter image description here

Edit: Thank you all. Now I use this code:

m = 1;
s = 1;
z = 2 m + 1;
ContourPlot[
BesselJ[z, BesselJZero[m, s]*Norm[{x, y}]]*
Sin[z*ArcTan[x, y]], {x, -5, 5}, {y, 0, 5}, Contours -> 10]

And I've got this plot: enter image description here

Just another question - The repeating pattern doesn't end at x=1, as it does in the image from instructions. Did I mess something up with the code or do I just have to normalize it somehow?

$\endgroup$
  • $\begingroup$ Hi ! You should go to the help centre read how to properly format your code and edit your question to reflect those guidelines. $\endgroup$ – Sektor Jun 10 '15 at 11:55
  • $\begingroup$ Thank you, I will try to format it properly. In the meantime, I still need an answer to my problem. $\endgroup$ – Katja Jun 10 '15 at 11:59
  • $\begingroup$ Do you have a reference for the eigenfunction formula you have? $\endgroup$ – J. M. will be back soon Jun 10 '15 at 14:28
  • $\begingroup$ My thinking is your hand plot is wrong, or I don't follow what it is you are plotting. The expression is zero for x=0, so you must get a zero contour line straight up the middle.. $\endgroup$ – george2079 Jun 10 '15 at 14:47
  • $\begingroup$ Now that you said it, I see that the formula I have is zero at x=0. However, in the instructions for this task (the whole task is actually about a method for solving PDEs) it is included that this formula returns solutions like the file I just attached (see edited post). First column has s=1, second column has s=2, first row has m=0, second m=1 and third m=2. I admit I'm completely lost now. I'll reread everything I have on this assignment. However, if you have any ideas about how to get these plots, please let me know. Thanks. $\endgroup$ – Katja Jun 10 '15 at 15:03