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.

Out[14]= 0.537450389063711<br />

7 Mathematica implementation of a quadratu<strong>re</strong> function<br />

The <strong>re</strong>sult is cor<strong>re</strong>ct to 13 digits, although Mathematica <strong>in</strong>itially considers it less <strong>re</strong>liable. The di e<strong>re</strong>nce<br />

<strong>in</strong> the last two digits is due to roundo errors. We can still improve the <strong>re</strong>sult by us<strong>in</strong>g a higher<br />

work<strong>in</strong>g p<strong>re</strong>cision and <strong>in</strong>clud<strong>in</strong>g mo<strong>re</strong> terms <strong>in</strong> the extrapolation.<br />

In[15]:= OscInt[f,#&,0,Work<strong>in</strong>gP<strong>re</strong>cision->30,NSumExtraTerms->25]<br />

Out[15]= 0.53745038906373283<br />

It is <strong>in</strong>te<strong>re</strong>st<strong>in</strong>g to notice that the last digit of the `exact' value given by Eh<strong>re</strong>nmark seems to be wrong,<br />

for if we let Mathematica compute the <strong>in</strong>tegral analytically, we obta<strong>in</strong> a slightly di e<strong>re</strong>nt <strong>re</strong>sult.<br />

In[16]:= Integrate[f[x],fx,0,Inf<strong>in</strong>ityg]<br />

Out[16]= Pi BesselI[0, 2] 3 3<br />

---------------- - 2 HypergeometricPFQ[f1g, f-, -g, 1]<br />

2 2 2<br />

In[17]:= N[%,20]<br />

Out[17]= 0.5374503890637328029<br />

Example 7.5.2<br />

Z 1<br />

In[18]:= f[x_] := S<strong>in</strong>[x]/Sqrt[x];<br />

OscInt[f,#&,0] - N[Sqrt[Pi/2],20]<br />

Out[18]= -12<br />

5.05929 10<br />

0<br />

r<br />

s<strong>in</strong> x<br />

p dx =<br />

x 2<br />

Aga<strong>in</strong> this <strong>re</strong>sult could be improved with a higher work<strong>in</strong>g p<strong>re</strong>cision, albeit at the expense of an<br />

<strong>in</strong>c<strong>re</strong>ased comput<strong>in</strong>g time.<br />

In[19]:= OscInt[f,#&,0,NSumTerms->30,NSumExtraTerms->20,<br />

Work<strong>in</strong>gP<strong>re</strong>cision->34] - N[Sqrt[Pi/2],30]<br />

Out[19]= -19<br />

0. 10<br />

The next <strong>in</strong>tegrals have been used by Espelid and Overholt as benchmarks [123]. S<strong>in</strong>ce their<br />

algorithm was tailo<strong>re</strong>d to <strong>re</strong>gularly oscillat<strong>in</strong>g <strong>in</strong>tegrands, the arguments of the s<strong>in</strong>-functions<br />

a<strong>re</strong> at least asymptotically l<strong>in</strong>ear.<br />

182

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

Saved successfully!

Ooh no, something went wrong!