In[1]:=
Needs["Rayica`Rayica`"]
+++++++++++++++++++++++++
GrinLens Examples
GRINLens is the latest optical element to be added to the Rayica/Wavica modeling environment. You can use GRINLens to model both many forms of graded-index refraction.
?GRINLens
Options[GRINLens]
GRINLens automatically uses a default index model that is called DefaultGRINIndex
?DefaultGRINIndex
ModelRefractiveIndex[DefaultGRINIndex]
Otherwise you can always define your own refractive index model as follows:
Unprotect[ModelRefractiveIndex]
ModelRefractiveIndex[GRINIndex] = Function[(2.5-.04*Dot[SurfaceCoordinates,SurfaceCoordinates])/.#]
grinrod = GRINLens[10,18, ComponentMedium->GRINIndex]
TurboPlot gives you the fastest trace, however you cannot see the interior of the GRINLens trace with TurboPlot.
TurboPlot[{LineOfRays[7,NumberOfRays->11],Move[grinrod,10], Boundary[50]},PlotType->TopView];
You can use AnalyzeSystem to visualize the interior of the GRINLens trace at the cost of a slower result.
AnalyzeSystem[{LineOfRays[7,NumberOfRays->11],Move[grinrod,10], Boundary[50]},PlotType->TopView];
DrawSystem[{Move[SingleRay[],{0,4.5}],Move[grinrod,{10,5},45], Boundary[50]},PlotType->TopView];
DrawSystem[{Move[SingleRay[],{0,0}],Move[grinrod,{10,10},-45], Boundary[50]},PlotType->TopView];
DrawSystem[{Move[SingleRay[],{0,4.5}],Move[grinrod,10], Boundary[50]},PlotType->TopView];
DrawSystem[{LineOfRays[9,NumberOfRays->11],Move[grinrod,10], Boundary[50]},PlotType->TopView];
You can also add a spherical surface curvature to the front and back of GRINLens as follows:
curvedgrinrod = GRINLens[10,-10,10,18,RunningCommentary->GradedRefraction]
DrawSystem[{LineOfRays[7,NumberOfRays->11],Move[curvedgrinrod,10], Boundary[50]},PlotType->TopView];
DrawSystem[{LineOfRays[7,NumberOfRays->11],Move[curvedgrinrod,10,-30], Boundary[50]},PlotType->TopView];
Optimize GrinLens
You can use SymbolicRefractiveModels with TurboPlot to specify your own symbolic function for the graded refractive index.
In[2]:=
?SymbolicRefractiveModels
grinrod = GRINLens[10,18]
sys = TurboPlot[{LineOfRays[7,NumberOfRays->11],Move[grinrod,10], Boundary[50]},PlotType->TopView, SymbolicRefractiveModels->{DefaultGRINIndex->(a-b SurfaceCoordinates.SurfaceCoordinates)}, SymbolicValues->{a->2.5, b->.04}];
Next you can use OptimizeSystem to find the optimal values for the symbolic constants: a and b.
sol = OptimizeSystem[{LineOfRays[7,NumberOfRays->11],Move[grinrod,10], Boundary[50]},PlotType->TopView, SymbolicRefractiveModels->{DefaultGRINIndex->(a-b SurfaceCoordinates.SurfaceCoordinates}, SymbolicValues->{a->2.5, b->.04}]
The optimization does not look very good in this instance.
TurboPlot[sys,sol,PlotType->TopView];
Here is a model that uses three symbol parameters and is a forth order function.
sys = TurboPlot[{LineOfRays[7,NumberOfRays->11],Move[grinrod,10], Boundary[50]},PlotType->TopView, SymbolicRefractiveModels->{DefaultGRINIndex->(a-b SurfaceCoordinates.SurfaceCoordinates-c (SurfaceCoordinates.SurfaceCoordinates)^2)}, SymbolicValues->{a->2.5, b->.04, c->.0001}];
The optimization is improved somewhat.
sol = OptimizeSystem[{LineOfRays[7,NumberOfRays->11],Move[grinrod,10], Boundary[50]},PlotType->TopView, SymbolicRefractiveModels->{DefaultGRINIndex->(a-b SurfaceCoordinates.SurfaceCoordinates-c (SurfaceCoordinates.SurfaceCoordinates)^2)}, SymbolicValues->{a->2.5, b->.04, c->.0001}]
TurboPlot[sys,sol,PlotType->TopView];
Finally here is a model that uses four symbol parameters and is a eighth order function.
sys = TurboPlot[{LineOfRays[7,NumberOfRays->11],Move[grinrod,10], Boundary[50]},PlotType->TopView, SymbolicRefractiveModels->{DefaultGRINIndex->(a-b SurfaceCoordinates.SurfaceCoordinates-c (SurfaceCoordinates.SurfaceCoordinates)^2-d (SurfaceCoordinates.SurfaceCoordinates)^4)}, SymbolicValues->{a->2.5, b->.04, c->.0001, d->.000001}];
sol = OptimizeSystem[{LineOfRays[7,NumberOfRays->11],Move[grinrod,10], Boundary[50]},PlotType->TopView, SymbolicRefractiveModels->{DefaultGRINIndex->(a-b SurfaceCoordinates.SurfaceCoordinates-c (SurfaceCoordinates.SurfaceCoordinates)^2-d (SurfaceCoordinates.SurfaceCoordinates)^4)}, SymbolicValues->{a->2.5, b->.04, c->.0001, d->.000001}]
The optimization is improved even further.
TurboPlot[sys,sol,PlotType->TopView];
Created by Mathematica (April 26, 2005)