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.
A.1 Numerical quadratu<strong>re</strong><br />
WynnDeg<strong>re</strong>e->Inf<strong>in</strong>ity,<br />
MaxIterations->5,<br />
AccuracyControl->False,<br />
IterationLength->2};<br />
Options[PartInt] = Options[OscInt];<br />
Options[PartitionTable] =<br />
{Work<strong>in</strong>gP<strong>re</strong>cision->$Mach<strong>in</strong>eP<strong>re</strong>cision,<br />
AccuracyGoal->Automatic,<br />
MaxRecursion->20,<br />
FunctionType->S<strong>in</strong>Argument};<br />
PolynomialDeg<strong>re</strong>e[f_] :=<br />
Length[CoefficientList[Series[f[x],{x,Inf<strong>in</strong>ity,1}],x]]-1;<br />
PolynomialDeg<strong>re</strong>e[f_,x_Symbol] :=<br />
Length[CoefficientList[Series[f,{x,Inf<strong>in</strong>ity,1}],x]]-1;<br />
AsymptoticExpand[f_] :=<br />
Normal[Series[f[x],{x,Inf<strong>in</strong>ity,PolynomialDeg<strong>re</strong>e[f]}]];<br />
AsymptoticExpand[f_,x_Symbol] :=<br />
Normal[Series[f,{x,Inf<strong>in</strong>ity,PolynomialDeg<strong>re</strong>e[f,x]}]];<br />
ApproxLimGeneric[f_,goal_] :=<br />
Module[{fapprox,<strong>re</strong>spos,<strong>re</strong>sneg,<strong>re</strong>s},<br />
fapprox = AsymptoticExpand[f];<br />
<strong>re</strong>spos = Select[<br />
NSolve[Evaluate[<br />
D[fapprox,x] /<br />
D[fapprox - f[x],x]] == goal,x],(Im[x/.#] == 0)&];<br />
<strong>re</strong>sneg = Select[<br />
NSolve[Evaluate[<br />
D[fapprox,x] /<br />
D[fapprox - f[x],x]] == -goal,x],(Im[x/.#] == 0)&];<br />
<strong>re</strong>s = Select[Jo<strong>in</strong>[<strong>re</strong>spos,<strong>re</strong>sneg],Positive[x/.#]&];<br />
If[Length[<strong>re</strong>s] == 0,<br />
Message[ApproxLimGeneric::nosolution],<br />
If[Length[<strong>re</strong>s] > 1,<br />
Message[ApproxLimGeneric::nounique,Length[<strong>re</strong>s],<strong>re</strong>s]];<br />
x/.Last[<strong>re</strong>s]]<br />
]<br />
ApproxLimQuad[a_,b_,c_,d_,goal_] := Which[<br />
a != 0 && c != 0 && d != 0,<br />
x/.Flatten[Last[<br />
NSolve[(2 a x + b + c) /<br />
(c (1-x/Sqrt[x^2+d])) == Sign[a c d] goal,x]]],<br />
a == 0 && c != 0 && d != 0,<br />
ApproxLimL<strong>in</strong>ear[b,c,d,goal],<br />
True,<br />
Message[ApproxLimQuad::noapprox];0]<br />
ApproxLimL<strong>in</strong>ear[a_,b_,c_,goal_] := Which[<br />
a + b == 0,<br />
Message[ApproxLimL<strong>in</strong>ear::noosc];0,<br />
Abs[(a + b) / b] > goal, 0,<br />
True,<br />
x/.Flatten[<br />
NSolve[(a + b) /<br />
(b (1-x/Sqrt[x^2+c])) == Sign[(a+b) b c] goal,x]]];<br />
QuadOffset[a_,b_,c_] := Which[<br />
a == 0, Ceil<strong>in</strong>g[c/Pi],<br />
a > 0,-Floor[(b^2 - 4 a c)/(4 a Pi)],<br />
True, -Ceil<strong>in</strong>g[(b^2 - 4 a c)/(4 a Pi)]];<br />
QuadZero[a_,b_,c_,o_][k_] := Which[<br />
a > 0, (-b+Sqrt[b^2-4 a (c-( k+o) Pi)])/(2 a),<br />
a < 0, (-b-Sqrt[b^2-4 a (c-(-k+o) Pi)])/(2 a),<br />
a == 0 && b > 0, (( k+o) Pi - c)/b,<br />
a == 0 && b < 0, ((-k+o) Pi - c)/b,<br />
True, k];<br />
HypApproxError[b_,c_,goal_] :=<br />
x/.Last[Solve[b (Sqrt[x^2 + c]-x) == Sign[c b] goal,x]];<br />
ZerosInBetween[zerof_,a_,b_] :=<br />
Module[{m<strong>in</strong>=M<strong>in</strong>[a,b], max=Max[a,b]},<br />
Which[N[zerof[0]] < m<strong>in</strong>,<br />
Ceil<strong>in</strong>g[i/.F<strong>in</strong>dRoot[zerof[i] == max,{i,0,1}]] -<br />
Ceil<strong>in</strong>g[i/.F<strong>in</strong>dRoot[zerof[i] == m<strong>in</strong>,{i,0,1}]],<br />
217