Wave Propagation in Linear Media | re-examined
Wave Propagation in Linear Media | re-examined
Wave Propagation in Linear Media | re-examined
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
8.3 Implementation of the quadratu<strong>re</strong> modules<br />
quadratu<strong>re</strong>. The<strong>re</strong> a<strong>re</strong> of course other function declarations necessary for the other <strong>re</strong>gions<br />
(<strong>in</strong>cident and <strong>re</strong> ected waves). However, they look very much the same as the mentionend<br />
<strong>in</strong>tegrands and thus a<strong>re</strong> not given he<strong>re</strong>.<br />
The quadratu<strong>re</strong> modules consist of two parts, the computation of the parameters <strong>re</strong>qui<strong>re</strong>d for<br />
the function calls and the quadratu<strong>re</strong> itself. Note that the parameters b and d a<strong>re</strong> evaluated<br />
numerically. In the case of b this is necessary to ensu<strong>re</strong> the cor<strong>re</strong>ct operation of the functions<br />
QuadOffset and QuadZero that comprise conditional statements and a<strong>re</strong> not p<strong>re</strong>pa<strong>re</strong>d to<br />
take symbolical arguments. On the other hand, it improves the performance of the module<br />
because it <strong>re</strong>duces the computation time by up to ten percent (depend<strong>in</strong>g on the actual<br />
parameter values). For the same <strong>re</strong>ason, the o set parameter of the function enumerat<strong>in</strong>g the<br />
zeros is calculated befo<strong>re</strong> the quadratu<strong>re</strong> starts. To p<strong>re</strong>vent <strong>in</strong>accuracies due to the numerical<br />
evaluation of the parameters, they a<strong>re</strong> calculated to a p<strong>re</strong>cision two digits higher than the<br />
Work<strong>in</strong>gP<strong>re</strong>cision.<br />
Remark (Version peculiarities) In the orig<strong>in</strong>al version of the package the o set values<br />
we<strong>re</strong> not computed numerically as shown <strong>in</strong> the example given below. The function<br />
QuadOffset thus <strong>re</strong>turned <strong>re</strong>sults like Ceil<strong>in</strong>g[const/Pi] that we<strong>re</strong> left unevaluated<br />
because Mathematica t<strong>re</strong>ats Pi as a symbol rather than as a number. This worked<br />
well most of the time, however, for particular sets of <strong>in</strong>put parameters the quadratu<strong>re</strong><br />
function would never term<strong>in</strong>ate. This peculiar behaviour seem<strong>in</strong>gly depended on the<br />
softwa<strong>re</strong> version (2.2) but not on the platform, which was veri ed on PCs as well as on<br />
SUN and HP workstations. Neither version 2.1 nor the new version 3.0 caused similar<br />
troubles. The problem could be overcome only by chang<strong>in</strong>g the <strong>re</strong>sults of QuadOffset<br />
<strong>in</strong>to numbers, which <strong>in</strong> turn provides another slight performance improvement.<br />
The quadratu<strong>re</strong> function OscInt is called four times with the arguments of the <strong>in</strong>tegrands set<br />
to the appropriate values taken from (8.30). In this connection it is important to notice that<br />
ow<strong>in</strong>g to the uniform structu<strong>re</strong> of the <strong>in</strong>tegrand functions we need to pass only the name of the<br />
function to the template, the arguments a<strong>re</strong> then added <strong>in</strong>side the module. The<strong>re</strong>fo<strong>re</strong> we can<br />
use the template for all parts of the wave. The <strong>re</strong>sults of the <strong>in</strong>dividual function calls a<strong>re</strong> then<br />
summed up with the coe cients given <strong>in</strong> (8.30) and multiplied with the waveform-dependent<br />
constant.<br />
RectTransTemp[fpos_, fneg_, x_, t_, w_, k_, opts___Rule] :=<br />
Module[fa,b,c,d,o11,o12,o21,o22,<br />
wp = Work<strong>in</strong>gP<strong>re</strong>cision/.foptsg/.Options[OscInt]g,<br />
a = -t;<br />
b = N[2 Pi k/Sqrt[w],wp+2];<br />
c = x;<br />
d = N[-2 Pi k,wp+2];<br />
o11 = N[QuadOffset[a, c,0],wp+2];<br />
o12 = N[QuadOffset[a,-c,0],wp+2];<br />
o21 = N[QuadOffset[a, b+c,d],wp+2];<br />
o22 = N[QuadOffset[a,-b-c,d],wp+2];<br />
(-(OscInt[fpos[a, 0, c,0,w,k],<br />
QuadZero[a, c,0,o11],1,FunctionType->ZeroList,opts] +<br />
201