## Sunday, October 16, 2011

### Ejs Open Source Double Slit Diffraction Model

Ejs Open Source Double Slit Diffraction Model
 Ejs Open Source Double Slit Diffraction Model http://weelookang.blogspot.sg/2011/10/ejs-open-source-double-slit-diffraction.htmlhttps://dl.dropboxusercontent.com/u/44365627/lookangEJSS/export/ejs_model_wave_doublelit2wee03.jar https://dl.dropboxusercontent.com/u/44365627/lookangEJSworkspace/export/ejs_users_sgeducation_lookang_wave_doublelit2wee03.jar author: fu-kwun hwang and lookang

Ejs Open Source Double Slit Diffraction Model by lookang based on the works of Fu-Kwun Hwang found here

reference:
Ejs Open Source Single Slit Diffraction Model by Fu-Kwun Hwang remixed by lookang http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=2314.0
Superposition of several waves http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=2082.0 by Fu-Kwun Hwang
other good applets
JDK Double slit interference by Fu-Kwun Hwang http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=20.0

Full screen applet
kindly hosted in NTNUJAVA Virtual Physics Laboratory by Professor Fu-Kwun Hwang http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=2315.0
alternatively, go direct to
Author: Fu-Kwun Hwang and lookang

redesign the slits to be 2 instead of the older single slit
made the 2 slits symmetric centered with moved by y slider
add the 2 slits scalarField by introducing the idea of superposition from the top set of secondary sources
Code:
```for(int i=0;i
yc=yi+i*dy; // lay the source in y
yctop=yitop+i*dy; // duplicate for top slit
ycc[i] = yi+i*dy; // by lookang for drawing source
ycctop[i] = yitop+i*dy; // by lookang for drawing source
for(int j=0;j
//  if (x
x=xmin+j*d;
//   }
//   else if (x>x1){
//  x=x1+j*d;
// r=x-x1; // r is distance from array point x to slit position x1
//  x2=(x-xc)*(x-xc);
//  }
for(int k=0;k
y=ymin+k*d;

if (x
r=x-x1; // r is distance from array point x to slit position x1
zsum[j][k]=Math.sin(kw*r-omega*t)*n; // need n to compensate for the magnitude
}
else if (x>=x1){
r=Math.sqrt((x-xc)*(x-xc)+(y-yc)*(y-yc));
rtop=Math.sqrt((x-xctop)*(x-xctop)+(y-yctop)*(y-yctop));
zsum[j][k]+=Math.sin(kw*r-omega*t)+Math.sin(kw*rtop-omega*t);
}

}
}
}

```
this simulation is made possible by the open source codes shared by Fu-Kwun Hwang, the true master teacher!

enjoy!