Snell's Law of Refraction (Wave Fronts)

Manipulate[With[{n1=nn,n2=n,a=-Sin[th],b=Cos[th],ν=1/f,h=10},With[{th2=If[n1/n2 Sin[th]≤1,ArcSin[n1/n2 Sin[th]],Pi-th]},Graphics[{
RGBColor[.41,.57,.91],{Opacity[.05+.95(Min[1,Log[n2]])],Rectangle[{-h,-h},{h,0}]},{Opacity[.05+.95(Min[1,Log[n1]])],Rectangle[{-h,0},{h,h}]},
RGBColor[.27,.2,.75],Thickness[.01],
Line[{{0,0},{-Sin[th],Cos[th]}}],Line[{{0,0},h{Sin[th2],-Cos[th2]}}],
RGBColor[.9,.42,.17],
Table[Line[Table[If[(t+r ν)/n1#[[2]]+b>0,(t+r ν)/n1#,((t+r ν)/n2
+b(n2-n1)/(-#[[2]]n2)) #]&[N@{Cos[s],Sin[s]}]+{a,b},{s,0,2Pi,Pi/100}]],{r,0,Round[f(3+2Max[n1,n2])]}]},PlotRange->2,ImageSize->{500,264}]]],{{th,1,"angle to normal (radians)"},0,Pi/2,Appearance->"Labeled"},
{{nn,1,"top refractive index"},1,4,Appearance->"Labeled"},
{{nn,1,"top material"},{1->"vacuum",1.00029->"air",1.33->"water",1.6->"glass",2.5->"diamond"}},
{{n,1.33,"bottom refractive index"},1,4,Appearance->"Labeled"},{{n,1.33,"bottom material"},{1->"vacuum",1.00029->"air",1.33->"water",1.6->"glass",2.5->"diamond"}},{{t,0,"time"},0,1},{{f,1,"frequency"},1,3},AutorunSequencing->{1,2,3}]

CAPTION

Light travels at different speeds through different materials, causing it to bend according to Snell's law. Here light is represented by traveling wave fronts coming from a light source above the boundary between two materials.

THIS NOTEBOOK IS THE SOURCE CODE FROM

"Snell's Law of Refraction (Wave Fronts)" from the Wolfram Demonstrations Project
 http://demonstrations.wolfram.com/SnellsLawOfRefractionWaveFronts/

Contributed by: Todd Rowland

Suggested by: Stephen Wolfram

A full-function Wolfram Mathematica system (Version 6 or higher) is required to edit this notebook.
GET WOLFRAM MATHEMATICA »

© Wolfram Demonstrations Project & Contributors   |   Terms of Use   |   Make a new version of this Demonstration »