Load Wavica and Rayica

In[1]:=

+++++++++++++++++++++++++++++++++++++++

Arbitrary Precision Calculations

Both Rayica and Wavica permit the use of abitrary precision calculations. This is controlled with the RayTracePrecision option:

In[2]:=

?RayTracePrecision

To illustrate this, we will work with the following optical system:

In[14]:=

sys = {WedgeOfRays[20],Move[PlanoConvexLens[100,50,10,CurvatureDirection->Back],90],Move[Screen[{50,50}],150]}

Out[14]=

In[15]:=

TurboPlot[sys];

Arbitrary Precision Calculations in Rayica

In Rayica, both the TurboPlot and TurboTrace functions support arbitrary precision calculations. In its default mode, however, all calculations are carried out in machine precision of 16 decimal places. Here is a default calculation of the optical length of the rays traced to the final screen surface:

In[6]:=

TurboTrace[sys,OpticalLength]//InputForm

Out[6]//InputForm=

{155.2594749592117, 155.23244752966428, 155.2594749592117}

Next, we use RayTracePrecision->50 to repeat the above calculation with 50 decimal places of precision:

In[7]:=

TurboTrace[sys,OpticalLength,RayTracePrecision->50]

Out[7]=

We can use TurboTrace with OutputType->RayTraceFunction to extract a ray-trace function model of the system. Again, we use RayTracePrecision->50. This model is stored in a variable called res.

In[8]:=

res = RayTraceFunction/.TurboTrace[sys,OpticalLength,OutputType->RayTraceFunction,RayTracePrecision->50]

Out[8]=

This stored RayTraceFunction can now make new calculations with different light source models. Here we use a LineOfRays and WedgeOfRays in separate calculations.

In[9]:=

res[LineOfRays[20]]

Out[9]=

In[10]:=

res[WedgeOfRays[20]]

Out[10]=

Arbitrary Precision Calculations in Wavica

Most functions in Wavica supports arbitrary precision control. This includes: SymbolicTrace, FindInterference, GaussianPlot, GaussianTrace, FindABCDMatrix , ZernikeFit, and FindWaveFronts. For remaining discussion, we will examine the use of FindWaveFronts and GaussianPlot.

FindWaveFronts in one dimension

Here is the default behavior of FindWaveFronts. This calculation shows the one-dimensional wavefront at the final screen surface in the system.

FindWaveFronts[sys]

Here is the same calculation with RayTracePrecision->50.

wav = FindWaveFronts[sys,RayTracePrecision->50]

(OpticalPathDifference/.wav[[1]])[15]

FindWaveFronts in two dimensions

The previous example used a two-dimensional WedgeOfRays source. Internally, this used an InterpolatingFunction to model the wavefront behavior. When three-dimensional sources are used instead, FindWaveFronts uses a Zernike-polynomial fit of the wavefront. Here is an optical system with the three-dimensional PointOfRays.

In[16]:=

sys2D = {PointOfRays[{15,15}],Move[PlanoConvexLens[100,50,10,CurvatureDirection->Back],90],Move[Screen[{50,50}],150]}

Out[16]=

In[17]:=

TurboPlot[sys2D];

Once again, the default behavior of FindWaveFronts is to make its calculation in machine precision:

Timing[wav0 = FindWaveFronts[sys2D]]

Next we use RayTracePrecision->100 with FindWaveFronts to increase the precision of the result to 100 decimal places.

Timing[wav = FindWaveFronts[sys2D,RayTracePrecision->100]]

GaussianPlot

GaussianPlot is used to calculate the diffractive behavior of Gaussian beams through space. We now examine how arbitrary precision calculations are made with GaussianPlot. Here is RayTracePrecision->50.

In[12]:=

GaussianPlot[{GaussianBeam[.2,4.9], Move[Screen[200],300]},RayTracePrecision->50]

Out[12]=

When you use RayTracePrecision->Infinity, the result is calculated with fractional integers rather than floating point numbers.

In[13]:=

GaussianPlot[{GaussianBeam[.2,4.9], Move[Screen[200],300]},RayTracePrecision->Infinity]

Out[13]=

Created by Mathematica (September 1, 2005)