Reflection and Refraction on a Flat Surface between Two Different Materials

Manipulate[
ai=ArcTan[pt[[2]],-pt[[1]]];
ar=ArcSin[n1/n2 Sin[ai]];
riftot=If[Abs[ar]>π/2,True,False];
Pane[Grid[{{
Framed@Graphics[{{Blue,Opacity[(n1-1)/3],Polygon[{{-1,0},{1,0},{1,1},{-1,1}}]},{Blue,Opacity[(n2-1)/3],Polygon[{{-1,0},{1,0},{1,-1},{-1,-1}}]},{Blue,Line[{{-1,0},{1,0}}],Dashed,Line[{{0,1},{0,-1}}]},{Red,Line[{{-2Sin[ai],2Cos[ai]},{0,0}}],If[n1≠n2,Line[{{0,0},{2Sin[ai],2Cos[ai]}}],{}],If[riftot,{},Line[{{0,0},{2Sin[ar],-2Cos[ar]}}]]}},PlotRange->{{-1,1},{-1,1}},ImageSize->{325,325}],
Text@Framed@Column[{Row[{"c = ",299792458," m/s"}],Row[{"(Subscript[v, 1]) = ",Floor[299792458/n1]," m/s"}],Row[{"(Subscript[v, 2]) = ",Floor[299792458/n2]," m/s"}],Row[{"(Subscript[α, i]) = ",Abs[ai]," rad = ",DegForm[180/π Abs[ai]]}],If[riftot,"(Subscript[α, r]) does not exist",Row[{"(Subscript[α, r]) = ",Abs[ar]," rad. = ",DegForm[180/π Abs[ar]]}]]},ItemSize->{17,Automatic}]
}}],
ImageSize->{575,350}
],
{{n1,1.00029,"(Subscript[n, 1])"},1,3,Manipulator,Appearance->"Labeled"},
{{n2,1.33,"(Subscript[n, 2])"},1,3,Manipulator,Appearance->"Labeled"},
{{n1,1.00029,"(Subscript[n, 1])"},If[lang,dataen,datait],PopupMenu},
{{n2,1.33,"(Subscript[n, 2])"},If[lang,dataen,datait],PopupMenu},
{{lang,True,"language for pulldown"},{True->"English",False->"Italian"},RadioButtonBar},
{{pt,{-1/2,1/2}},{-1,0},{1,1},Locator},
Initialization:>(DegDigits[x_]:=Module[{p},p=FractionalPart[x];{IntegerPart[x],IntegerPart[60p],60FractionalPart[60p]}];DegForm[x_]:=Module[{p,m,s},{p,m,s}=DegDigits[x];ToString@p<>"° "<>ToString@m<>"' "<>ToString@N[s]<>"'' "];dataen={1->"vacuum",1.00029->"air",1.33->"water",1.36->"acetone",1.37->"grain alcohol",1.38->"sugar sol. 30%",1.46->"melt quartz",1.49->"sugar sol. 80%",1.52->"'crown' glass",1.54->"sodium chloride",1.55->"polystyrene",1.63->"carbon disulfide",1.65->"'flint' glass",1.77->"sapphire",1.89->"heavy 'flint' glass",2.42->"diamond"};datait={1->"vuoto",1.00029->"aria",1.33->"acqua",1.36->"acetone",1.37->"etanolo",1.38->"sol. zucch. 30%",1.46->"quarzo fuso",1.49->"sol. zucch. 80%",1.52->"vetro crown",1.54->"cloruro di sodio",1.55->"polistirene",1.63->"disolfuro di carbonio",1.65->"vetro flint",1.77->"zaffiro",1.89->"vetro flint pesante",2.42->"diamante"}),TrackedSymbols->Manipulate]

CAPTION

When a ray of light hits the surface between two different materials, part of it is reflected and part of it is refracted through the second material. Call (Subscript[α, i]) the angle between the incoming ray and the normal to the surface. The angle of reflection is (Subscript[α, i]), while the angle of refraction is (Subscript[α, r]), satisfying (Subscript[n, 1])sin((Subscript[α, i]))=(Subscript[n, 2])sin((Subscript[α, r])), where (Subscript[n, 1]) and (Subscript[n, 2]) are the ratios between the speed of light in a vacuum and in the materials, (Subscript[n, 1])=c/(Subscript[v, 1]) and (Subscript[n, 2])=c/(Subscript[v, 2]). There is no reflected ray when (Subscript[n, 1])=(Subscript[n, 2]).

If the angle (Subscript[α, r]) is greater than 90°, there is total reflection, which means that the ray does not cross the surface. (This is explicitly indicated in the panel on the right as "(Subscript[α, r]) does not exist".)

THIS NOTEBOOK IS THE SOURCE CODE FROM

"Reflection and Refraction on a Flat Surface between Two Different Materials" from the Wolfram Demonstrations Project
 http://demonstrations.wolfram.com/ReflectionAndRefractionOnAFlatSurfaceBetweenTwoDifferentMate/

Contributed by: Stra Federico

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 »