## Tuesday, May 22, 2012

### Diffraction of a Cross

This was an assignment for my E+M class (836) that calculates the diffraction of light around a cross which is expressed exactly by the Fresnel integral:
$E(x,y,z)=\frac{z}{i \lambda}\int E(x',y',0) \frac{e^{ikr}}{r^2}dx'dy'$,

where $E(x',y',0)$ is the electric field of the aperture, and

$r=\sqrt{(x-x')^2+(y-y')^2+z^2}$.
So, the electric field of a cross would be some amplitude $E(x',y',0) = E_o$ where the cross is located, and $0$ everywhere else. Plug that in, and now you have the diffracted electric field $E(x,y,z)$ everywhere in space...mod-square that to see what our eyes see! In the mathematica file I calculate the intensity on a screen located just 1micron away up to 100 microns away from the aperture screen, and you can gradually see more and more interference. Note that on a screen an "infinite" distance away (called Fraunhofer diffraction) the E-field is just the 2D Fourier transform of the initial electric field!

### How to Embed Mathematica CDF in a Blogger Blog Post

STEP 1:
In Blogger go to
Template-> Edit HTML-> Click "proceed" when warned about messing with your HTML

Insert the following code after <head>, like in the image below:
<script src='http://blog.wolfram.com/common/javascript/cdfplugin/1.0/cdfplugin.js?ver=2.8.4' type='text/javascript'/>

STEP 2:
Create a new post, and click Edit HTML for that post (different from the Edit HTML for the template), and then insert the following code into the body of your post where you want a CDF to appear:
<script type="text/javascript" src="http://www.wolfram.com/cdf-player/plugin/v2.1/cdfplugin.js"></script> <script type="text/javascript"> var cdf = new cdfplugin(); cdf.embed('http://blog.wolfram.com/data/uploads/2011/07/Animation11.cdf', 400, 300); </script>
Then, publish your post, and it looks like this:

STEP 3:
Now to put your CDF in your blog, just change "http://blog.wolfram.com/data/uploads/2011/07/Animation11.cdf" to the URL to your CDF, and change the values "400, 300" = "width, height" to the values that best fit your blog.
I get my URL by uploading my CDFs to the "public" folder of my free Dropbox account, and copy-pasting the "public link" of the file.