fresnel eqns.nb

units and constants

nm=(10^(-9));cm=(10^(-2));mm=(10^(-3));um=(10^(-6));
fs=(10^(-15));ps=(10^(-12));
c=3 (10^8);

fresnel equations for dielectric interface r and t
parallel means E field is parallel to plane of incidence: S polarization
perpendicular means E field is perp to plane of incidence: P polarization

Snell's Law for transmitted angle: this is imaginary for incident angle greater than the critical angle for TIR

θT[θI_,nI_,nT_]:=ArcSin[nI Sin[θI]/nT];

transmission:

tParall[nI_,nT_,θI_,θT_]:=((2 nI Cos[θI])/(nT Cos[θI]+nI Cos[θT]));
tPerp[nI_,nT_,θI_,θT_]:=((2 nI Cos[θI])/(nI Cos[θI]+nT Cos[θT]));

reflection

rParall[nI_,nT_,θI_,θT_]:=((nT Cos[θI]-nI Cos[θT])/(nT Cos[θI]+nI Cos[θT]));
rPerp[nI_,nT_,θI_,θT_]:=((nI Cos[θI]-nT Cos[θT])/(nI Cos[θI]+nT Cos[θT]));

power transmission coeff
T=((Abs[t])^2) Re[(((Subscript[n, t])Cos[(Subscript[θ, t])])/((Subscript[n, i])Cos[(Subscript[θ, i])]))]
The extra factor accounts for the beam size change upon refraction from one index to another.

TParall[nI_,nT_,θI_,θT_]=((Abs[tParall[nI,nT,θI,θT]])^2)Re[((nT Cos[θT])/(nI Cos[θI]))];
TPerp[nI_,nT_,θI_,θT_]=((Abs[tPerp[nI,nT,θI,θT]])^2)Re[((nT Cos[θT])/(nI Cos[θI]))];

power reflection coeff
R=((Abs[r])^2)

RParall[nI_,nT_,θI_,θT_]=((Abs[rParall[nI,nT,θI,θT]])^2);
RPerp[nI_,nT_,θI_,θT_]=((Abs[rPerp[nI,nT,θI,θT]])^2);

Brewster angle

θBrewster[nI_,nT_]:=ArcTan[nT/nI];

critical angle for TIR:

θCrit[nI_,nT_]:=ArcSin[nT/nI];

plots

as θI goes to zero, these two expressions should be the same. But the sign convention we used for the directions of the fields was not consistent in this limit. 
note that the sign change corresponds to a phase change of 180degrees

θmin=0;θmax=90;

Power reflectivity and transmission

Print["R (power) parallel, P: blue, perpendicular, S: red"];
Manipulate[
Plot[{
RParall[n1,n2,θI °,θT[θI °,n1,n2]],
RPerp[n1,n2,θI °,θT[θI °,n1,n2]],
TParall[n1,n2,θI °,θT[θI °,n1,n2]],
TPerp[n1,n2,θI °,θT[θI °,n1,n2]]},
{θI,θmin,θmax},PlotRange->{0,1},PlotStyle->{Blue,Red,{Blue,Dashing[0.01]},{Red,Dashing[0.01]}},GridLines->{{θBrewster[n1,n2]/Degree},{1}}],
{n1,1,2.5},{n2,1,2.5}]

transmission amplitude

Print["t (amplitude): Blue is parallel, P; Red is perpendicular, S"];
Manipulate[
Plot[{
tParall[n1,n2,θI °,θT[θI °,n1,n2]],
tPerp[n1,n2,θI °,θT[θI °,n1,n2]]},
{θI,θmin,θmax},PlotRange->{0,3},PlotStyle->{Blue,Red},GridLines->{If[n1>n2,
{θBrewster[n1,n2]/Degree,θCrit[n1,n2]/Degree},{θBrewster[n1,n2]/Degree}],
None}],
{n1,1,2.5},{n2,1,2.5}]

reflection amplitude

sign convention for angles results in opposite sign for P and S at θ = 0

Print["r (amplitude): Blue is parallel, P; Red is perpendicular, S"];
Manipulate[
Plot[{
rParall[n1,n2,θI °,θT[θI °,n1,n2]],rPerp[n1,n2,θI °,θT[θI °,n1,n2]]},
{θI,θmin,θmax},PlotRange->{-1,1},PlotStyle->{Blue,Red},GridLines->{If[n1>n2,
{θBrewster[n1,n2]/Degree,θCrit[n1,n2]/Degree},{θBrewster[n1,n2]/Degree}],
None}],
{n1,1,2.5},{n2,1,2.5}]

phase shifts

Print["ϕr = Arg[r]: Blue is parallel, P; Red is perpendicular, S; Black is Δϕ"];
Manipulate[
Plot[{
Arg[rParall[n1,n2,θI °,θT[θI °,n1,n2]] ],
Arg[rPerp[n1,n2,θI °,θT[θI °,n1,n2]] ],
Arg[rPerp[n1,n2,θI °,θT[θI °,n1,n2]] ]-Arg[rParall[n1,n2,θI °,θT[θI °,n1,n2]] ]},
{θI,θmin,θmax},PlotRange->{-π,π},
PlotStyle->{Blue,Red,GrayLevel[0]},GridLines->{If[n1>n2,
{θBrewster[n1,n2]/Degree,θCrit[n1,n2]/Degree},{θBrewster[n1,n2]/Degree}],
None}],
{n1,1,2.5},{n2,1,2.5}]

verify that

R+T = 1

Print["R + T = 1"];
Plot[{
TParall[n1Tst,n2Tst,thItst °,thT[thItst °,n1Tst,n2Tst]],RParall[n1Tst,n2Tst,thItst °,thT[thItst °,n1Tst,n2Tst]],
TParall[n1Tst,n2Tst,thItst °,thT[thItst °,n1Tst,n2Tst]]+RParall[n1Tst,n2Tst,thItst °,thT[thItst °,n1Tst,n2Tst]]},
{thItst,θmin,θmax},PlotRange->{0,1.01},PlotStyle->{Blue,Red,Gray}]