In:= +++++++++++++++++++++++++++++++++++++++  Arbitrary Precision Calculations

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

In:=

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

In:=

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

Out= In:=

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:=

TurboTrace[sys,OpticalLength]//InputForm

Out//InputForm=

{155.2594749592117, 155.23244752966428, 155.2594749592117}

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

In:=

TurboTrace[sys,OpticalLength,RayTracePrecision->50]

Out= 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:=

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

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

In:=

res[LineOfRays]

Out= In:=

res[WedgeOfRays]

Out= 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[]) 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:=

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

Out= In:=

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:=

GaussianPlot[{GaussianBeam[.2,4.9], Move[Screen,300]},RayTracePrecision->50] Out= When you use RayTracePrecision->Infinity, the result is calculated with fractional integers rather than floating point numbers.

In:=

GaussianPlot[{GaussianBeam[.2,4.9], Move[Screen,300]},RayTracePrecision->Infinity] Out= Created by Mathematica  (September 1, 2005)