27.12.2012 Views

Wave Propagation in Linear Media | re-examined

Wave Propagation in Linear Media | re-examined

Wave Propagation in Linear Media | re-examined

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

];<br />

N[zerof[0]] < max,<br />

Ceil<strong>in</strong>g[i/.F<strong>in</strong>dRoot[zerof[i] == max,{i,0,1}]],<br />

True,<br />

Message[ZerosInBetween::outside];0]<br />

HypOffset[a_,b_,c_,d_] := Which[<br />

(Abs[b] > Abs[a]) && (c >= 0) && (a+b) > 0,<br />

Ceil<strong>in</strong>g[((a+b) (-Sign[a b] Sqrt[a^2 c/(b^2-a^2)]) + d)/Pi],<br />

(Abs[b] > Abs[a]) && (c >= 0) && (a+b) < 0,<br />

Floor[((a+b) (-Sign[a b] Sqrt[a^2 c/(b^2-a^2)]) + d)/Pi],<br />

(a+b) > 0, Ceil<strong>in</strong>g[d/Pi],<br />

(a+b) < 0, Floor[d/Pi],<br />

True, 0];<br />

HypZero[a_,b_,c_,d_,o_][k_] := Which[<br />

(a+b) > 0, (( k + o) Pi - d)/(a + b),<br />

(a+b) < 0, ((-k + o) Pi - d)/(a + b),<br />

True, Inf<strong>in</strong>ity];<br />

HypOffsetExact[a_,b_,c_,d_] := Which[<br />

(Abs[b] > Abs[a]) && (c >= 0) && (a+b) > 0,<br />

Ceil<strong>in</strong>g[((a x + b Sqrt[x^2+c] + d)/Pi)/.<br />

x->(-Sign[a b] Sqrt[a^2 c/(b^2-a^2)])],<br />

(Abs[b] > Abs[a]) && (c >= 0) && (a+b) < 0,<br />

Floor[((a x + b Sqrt[x^2+c] + d)/Pi)/.<br />

x->(-Sign[a b] Sqrt[a^2 c/(b^2-a^2)])],<br />

(a+b) > 0, Ceil<strong>in</strong>g[(b Sqrt[c] + d)/Pi],<br />

(a+b) < 0, Floor[(b Sqrt[c] + d)/Pi],<br />

True, 0];<br />

HypZeroExact[a_,b_,c_,d_,o_][k_] := Which[<br />

(a+b) > 0 && (Abs[b] > Abs[a]),<br />

(a (( k+o) Pi-d) - Sqrt[b^2 ((a^2-b^2) c + (( k+o) Pi-d)^2)])/(a^2-b^2),<br />

(a+b) < 0 && (Abs[b] > Abs[a]),<br />

(a ((-k+o) Pi-d) - Sqrt[b^2 ((a^2-b^2) c + ((-k+o) Pi-d)^2)])/(a^2-b^2),<br />

(a+b) < 0 && (Abs[b] < Abs[a]),<br />

(a ((-k+o) Pi-d) - Sign[a b] Sqrt[b^2 ((a^2-b^2) c + ((-k+o) Pi-d)^2)])/(a^2-b^2),<br />

(a+b) > 0 && (Abs[b] < Abs[a]),<br />

(a (( k+o) Pi-d) - Sign[a b] Sqrt[b^2 ((a^2-b^2) c + (( k+o) Pi-d)^2)])/(a^2-b^2),<br />

a == b && N[(2 a ((k+o) Pi - d))] != 0,<br />

(((k+o) Pi - d)^2 - a^2 c)/(2 a ((k+o) Pi - d)),<br />

True, Inf<strong>in</strong>ity];<br />

PartInt[f_, zerotab_List, a_, opts___Rule] :=<br />

Module[{zeros = zerotab, seqtab,<br />

wp = Work<strong>in</strong>gP<strong>re</strong>cision/.{opts}/.Options[OscInt],<br />

ag = AccuracyGoal/. {opts}/.Options[OscInt],<br />

pg = P<strong>re</strong>cisionGoal/. {opts}/.Options[OscInt],<br />

mi = M<strong>in</strong>Recursion/. {opts}/.Options[OscInt],<br />

ma = MaxRecursion/. {opts}/.Options[OscInt],<br />

nt = NSumTerms/. {opts}/.Options[OscInt],<br />

ne = NSumExtraTerms/. {opts}/.Options[OscInt],<br />

wd = WynnDeg<strong>re</strong>e/. {opts}/.Options[OscInt]},<br />

If[N[zeros[[1]]] < N[a],<br />

zeros = Select[zeros,(N[#] >= a)&];<br />

Message[OscInt::lowfirst,Length[zeros]]];<br />

If[N[zeros[[1]]] == N[a], 0,<br />

NIntegrate[f[x],{x,a,zeros[[1]]},<br />

Method->DoubleExponential,<br />

Work<strong>in</strong>gP<strong>re</strong>cision->wp,<br />

AccuracyGoal->ag,<br />

P<strong>re</strong>cisionGoal->pg,<br />

M<strong>in</strong>Recursion->mi,<br />

MaxRecursion->ma]] +<br />

If[N[zeros[[1]]] == Inf<strong>in</strong>ity, 0,<br />

seqtab = Table[NIntegrate[f[x],{x,zeros[[i]],zeros[[i+1]]},<br />

Method->GaussKronrod,<br />

Work<strong>in</strong>gP<strong>re</strong>cision->wp,<br />

AccuracyGoal->ag,<br />

P<strong>re</strong>cisionGoal->pg,<br />

M<strong>in</strong>Recursion->mi,<br />

MaxRecursion->ma],<br />

{i,1,Length[zeros]-1}];<br />

SequenceLimit[Take[FoldList[Plus,0,seqtab],{nt+1,nt+ne}],<br />

WynnDeg<strong>re</strong>e->wd]]<br />

];<br />

PartitionTable[zerof_, a_, n_, opts___Rule] :=<br />

Module[{ofs=0,x,xoffs,koffs,ext<strong>re</strong>ma,cfoffs=0,<br />

wp = Work<strong>in</strong>gP<strong>re</strong>cision/.{opts}/.Options[PartitionTable],<br />

ag = AccuracyGoal/. {opts}/.Options[PartitionTable],<br />

ma = MaxRecursion/. {opts}/.Options[PartitionTable],<br />

ft = FunctionType/. {opts}/.Options[PartitionTable]},<br />

218<br />

A Mathematica packages

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!