Group Abstract Group Abstract

Message Boards Message Boards

Intensity of light in double slit experiment?

POSTED BY: Wonseok Lee
10 Replies

I just would like to give the advice to do things step by step - one step at a time - and check, if each step is giving something meaningful. If you had done so, you would have noticed, that e.g.

Leng[_L,_u,_v,_r] :=  ...

is certainly not what you want, but rather

Leng[L_, u_, v_, r_] := ...

And it is good practice not to let symbol names start with capital letters.

POSTED BY: Henrik Schachner

Dear Henrick, thank you for your kind helps.

Is there a way to make the body of revolution with a 2D image(eg. a triangle into a cone by rotation)?

By this, I meant to talk about a solid of revolution(eg. rotating a triangle about its base line)(Sorry for my short Eng). And working on the single-slit problem, I got the solution of the amplitude of the light in integral form and tried to make it in a plot in order to check if it's right and how several variables affect the shape of the spectrum. What I wanted to ask was this, but I think I didn't make it clear. Sorry for that.

The solution I got for single-slit problem is:

Leng[_L,_u,_v,_r]:=Sqrt[(u+r)^2 +v^2 +L^2];

Amp[_L,_d,_k,_x]:=Integrate[Sin[k Leng[L, u, v, r]]/Leng[L,u,v,r],
{u,v} \[Element] Circle[{0, 0}, 0.5 d]]/ 
Integrate[1/Leng[L,u,v,r], {u,v} \[Element] Circle[{0,0},0.5d]];

Manipulate[Plot[Amp[L,d,k,x]^2, {x,-8,8}, PerformanceGoal->"Quality", PlotPoints->40,
ImageSize->Large], {L, 1, 3}, {d, 10^-6, 3 10^-6}, {k, 2Pi/3 10^7, 0.25Pi 10^7}]
POSTED BY: Wonseok Lee

Wow, it works! Thank you for your clear answer! Actually, the spectrum graph of the function mentioned upon doesn't respond smoothly as I control the slide by Manipulate function and I should wait until the spectrum becomes smooth. Then is this problem similar to this and able to be solved in the same way?

POSTED BY: Wonseok Lee

Actually, the spectrum graph of the function mentioned upon doesn't respond smoothly as I control the slide by Manipulate function ...

This probably can be improved by using the option PerformanceGoal within Plot:

Plot[   ...   , PerformanceGoal -> "Quality"]
POSTED BY: Henrik Schachner

Dear Henrik, Thank you for your reply. Problems are gone! But what's the difference between

DensityPlot[  ...  ,PlotPoints -> 50]

and

ImageAdjust@Image[ConstantArray[Table[  ...  ]

?

POSTED BY: Wonseok Lee

Dear Wonseok Lee, glad to help!

But what's the difference between ...

With Table[ ... ] the values of just a single line of pixels is calculated, and with ConstantArray[Table[ ... ], 300] this line is simply replicated 300 times. DensityPlot can not know that all lines are identical and so the same sequence of calculations is done for every line.

POSTED BY: Henrik Schachner

Oh, I got it. The method you explained is 'making one line and replicate it many times', right? Nowadays, I'm working on the single-slit diffraction problem to make the screen image. However, to calculate the Plot3D, it takes too much running time. Is there a way to make the body of revolution with a 2D image(eg. a triangle into a cone by rotation)?

POSTED BY: Wonseok Lee

However, to calculate the Plot3D, it takes too much running time.

You are probably talking about doing it like so:

intens[L_, d_, \[Lambda]_, x_] := 
  1/(L^2 + (x - 0.5 d)^2) + 
   1/(L^2 + (x + 0.5 d)^2) + (2 Cos[
       2 Pi Abs[
          Sqrt[L^2 + (x - 0.5 d)^2] - 
           Sqrt[L^2 + (x + 0.5 d)^2]]/\[Lambda]])/(Sqrt[
       L^2 + (x - 0.5 d)^2] Sqrt[L^2 + (x + 0.5 d)^2]);
Manipulate[
 Plot3D[intens[L, d, \[Lambda], x], {x, -5, 5}, {L, 1, 3}, 
  PlotRange -> All, PerformanceGoal -> "Quality", PlotPoints -> 40, 
  ImageSize -> Large, MeshFunctions -> {#3 &}, 
  ColorFunction -> "TemperatureMap"],
 {d, 10^-6, 3 10^-6}, {\[Lambda], 3 10^-7, 8 10^-7}]

Yes, generating such a Plot3D within Manipulate is painfully slow. But this is not very surprising, because a lot of calculation needs to be done. I do not know what you mean by:

Is there a way to make the body of revolution with a 2D image(eg. a triangle into a cone by rotation)?

One standard way if calculations need to be done faster is to use Compile:

cIntens = 
  Compile[{{L, _Real}, {d, _Real}, {\[Lambda], _Real}, {x, _Real}}, 
   Module[{pls, min, sqrpls, sqrmin},
    pls = L^2 + (0.5` d + x)^2;
    min = L^2 + (-0.5` d + x)^2;
    sqrpls = Sqrt[pls];
    sqrmin = Sqrt[min];
    1/min + 1/pls + 2 Cos[2 Pi/\[Lambda] Abs[sqrmin - sqrpls]]/(sqrmin sqrpls)], 
   RuntimeOptions -> "Speed", CompilationTarget -> "C"];

Manipulate[
 Plot3D[cIntens[L, d, \[Lambda], x], {x, -5, 5}, {L, 1, 3}, 
  PlotRange -> All, PerformanceGoal -> "Quality", PlotPoints -> 40, 
  ImageSize -> Large, MeshFunctions -> {#3 &}, 
  ColorFunction -> "TemperatureMap"],
 {d, 10^-6, 3 10^-6}, {\[Lambda], 3 10^-7, 8 10^-7}]

enter image description here

This is still somewhat slow, but much better. If you do not have a C-compiler installed on you system, then just leaf the option CompilationTarget -> "C" away.

POSTED BY: Henrik Schachner
Posted 5 years ago

Dear Henrick, thank you for your kind helps.

Is there a way to make the body of revolution with a 2D image(eg. a triangle into a cone by rotation)?

By this, I meant to talk about a solid of revolution(eg. rotating a triangle about its base line)(Sorry for my short Eng). And working on the single-slit problem, I got the solution of the amplitude of the light in integral form and tried to make it in a plot in order to check if it's right and how several variables affect the shape of the spectrum. What I wanted to ask was this, but I think I didn't make it clear. Sorry for this.

The solution I got for single-slit problem is:

Leng[_L,_u,_v,_r]:=Sqrt[(u+r)^2 +v^2 +L^2];

Amp[_L,_d,_k,_x]:=Integrate[Sin[k Leng[L, u, v, r]]/Leng[L,u,v,r],
{u,v} \[Element] Circle[{0, 0}, 0.5 d]]/ 
Integrate[1/Leng[L,u,v,r], {u,v} \[Element] Circle[{0,0},0.5d]];

Manipulate[Plot[Amp[L,d,k,x]^2, {x,-8,8}, PerformanceGoal->"Quality", PlotPoints->40,
ImageSize->Large], {L, 1, 3}, {d, 10^-6, 3 10^-6}, {k, 2Pi/3 10^7, 0.25Pi 10^7}]
POSTED BY: Updating Name

Hello Wonseok Lee,

I guess this effect is due to insufficient resolution of your DensityPlot. You can fix this using the option PlotPoints, e.g.:

DensityPlot[    ...      , PlotPoints -> 50]

then the whole image looks a bit different (i.e. more correct), but Manipulate works very slowly. An alternative way (my suggestion) might be to use Image, e.g.:

Manipulate[
 ImageAdjust@Image[ConstantArray[
   Table[1/(L^2 + (x - 0.5 d)^2) + 
     1/(L^2 + (x + 0.5 d)^2) + (2 Cos[
         2 Pi Abs[
            Sqrt[L^2 + (x - 0.5 d)^2] - 
             Sqrt[L^2 + (x + 0.5 d)^2]]/\[Lambda]])/(Sqrt[
         L^2 + (x - 0.5 d)^2] Sqrt[L^2 + (x + 0.5 d)^2]), {x, -8, 
     8, .005}], 300]], {L, 1, 3}, {d, 10^-6, 3 10^-6}, {\[Lambda], 
  3 10^-7, 8 10^-7}]

Regards -- Henrik

POSTED BY: Henrik Schachner
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard