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.
7.3 Implementation of OscInt and <strong>re</strong>lated functions<br />
<strong>in</strong> order to nd a rule that matches a given set of arguments. If the two de nitions we<strong>re</strong><br />
<strong>in</strong>terchanged, a list fb,b0g would match the pattern a , and consequently the variable a<br />
would erroneously be assigned the value fb,b0g.<br />
The function rst extracts the values of a couple of <strong>re</strong>levant options and then checks whether<br />
error control is <strong>re</strong>qui<strong>re</strong>d. If both AccuracyControl and P<strong>re</strong>cisionControl equal Inf<strong>in</strong>ity,<br />
then no error control is used, and OscInt performs a straightforward computation. The lower<br />
limit of the list of subdivision po<strong>in</strong>ts is set either to a or maxfa; a0g, the latter be<strong>in</strong>g calculated<br />
numerically at a higher p<strong>re</strong>cision, because the function Max works only with numbers but not<br />
with symbols.<br />
Remark (Options and defaults) The lter<strong>in</strong>g of the options is worth a separate<br />
mention [146]. It is accomplished by a double <strong>re</strong>placement rule like for <strong>in</strong>stance <strong>in</strong> wp<br />
= Work<strong>in</strong>gP<strong>re</strong>cision/.foptsg/.Options[OscInt], which works as follows: If the user<br />
speci es a value Work<strong>in</strong>gP<strong>re</strong>cision->p<strong>re</strong>c for this option, then it is passed to the function<br />
<strong>in</strong> the argument opts. The statement is now evaluated from the left to the right, and<br />
the rst <strong>re</strong>placement evaluates to p<strong>re</strong>c. The second substitution fails because the list<br />
of default options obta<strong>in</strong>ed by Options[OscInt] conta<strong>in</strong>s of course no rule p<strong>re</strong>c->x. If,<br />
on the other hand, the function is called without any option, then the rst <strong>re</strong>placement<br />
cannot be evaluated. In this case, the second rule matches and wp is set to the default<br />
value.<br />
The number of partition po<strong>in</strong>ts is obta<strong>in</strong>ed from NSumTerms plus NSumExtraTerms plus one,<br />
so that the sequence of partial sums has the cor<strong>re</strong>ct length for extrapolation. With the list<br />
of subdivision po<strong>in</strong>ts, PartInt is called to compute the actual <strong>in</strong>tegral.<br />
If error control is to be used, a <strong>re</strong>asonable value for the Work<strong>in</strong>gP<strong>re</strong>cision is calculated<br />
from the mach<strong>in</strong>e p<strong>re</strong>cision plus one, the parameter wp that might have been set by the user<br />
(or equals the default value otherwise), and the P<strong>re</strong>cisionControl parameter if applicable.<br />
This work<strong>in</strong>g p<strong>re</strong>cision, which might di er from the user's speci cation, is then used <strong>in</strong> the<br />
call of the function OscIntControlled. Note that this particular option is placed befo<strong>re</strong><br />
the other options opts, which causes the new sett<strong>in</strong>g for Work<strong>in</strong>gP<strong>re</strong>cision to override any<br />
other speci cation for this option, because Mathematica takes the rst value it encounters<br />
and dis<strong>re</strong>gards all subsequent ones.<br />
7.3.2 PartitionTable<br />
This function actually only calls PartitionOffs and PartitionPo<strong>in</strong>ts, but is nonetheless<br />
useful for the computation of a list of subdivision po<strong>in</strong>ts. Its syntax is<br />
PartitionTable[zerof, a, n, opts]<br />
with the same <strong>in</strong>put arguments as OscInt except for n, which denotes the number of partition<br />
po<strong>in</strong>ts to be computed. The options a<strong>re</strong> the same as for OscInt.<br />
167