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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

7.4.3 Approximation error control<br />

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

Another auxilliary function implements the criterion of equation (6.13),<br />

0 (x)<br />

0 (x) , 0 (x) = k;<br />

which has been given as a quality measu<strong>re</strong> for asymptotic partition. It <strong>re</strong>lates the argument<br />

function and its polynomial approximation by means of their <strong>re</strong>spective oscillation f<strong>re</strong>quencies.<br />

The di e<strong>re</strong>nce between these two cause the actual partition po<strong>in</strong>ts to deviate from the ideal<br />

phase <strong>in</strong>variant positions, which <strong>in</strong> turn produces wavepacket-like pictu<strong>re</strong>s <strong>in</strong> the sequence of<br />

partial sums. Hence the above formula hence gives the length of such awave packet depend<strong>in</strong>g<br />

on the abscissa value. We would like, however, to p<strong>re</strong>scribe k and get the cor<strong>re</strong>spond<strong>in</strong>g x as<br />

a <strong>re</strong>sult <strong>in</strong> order to know whe<strong>re</strong> to start the extrapolation. The functions needed to this end<br />

exploit the symbolical calculation capabilities of Mathematica.<br />

To nd the polynomial approximation of a given function f(x) for x ! 1, we de ne two<br />

small rout<strong>in</strong>es that determ<strong>in</strong>e the polynomial deg<strong>re</strong>e of f(x) and then compute the asymptotic<br />

expansion to the cor<strong>re</strong>ct order.<br />

PolynomialDeg<strong>re</strong>e[f_,x_Symbol] :=<br />

Length[CoefficientList[Series[f,fx,Inf<strong>in</strong>ity,1g],x]]-1;<br />

AsymptoticExpand[f_,x_Symbol] :=<br />

Normal[Series[f,fx,Inf<strong>in</strong>ity,PolynomialDeg<strong>re</strong>e[f,x]g]];<br />

Remark (Series expansion) The function Series[f, x, x0, n] generates a power series<br />

expansion for a given function to the order n about the po<strong>in</strong>t x0. In PolynomialDeg<strong>re</strong>e<br />

we use it just to determ<strong>in</strong>e the highest order terms, that is why we set n = 1. With<br />

CoefficientList we then obta<strong>in</strong> a list of the coe cients of the <strong>re</strong>sult<strong>in</strong>g polynomial<br />

and, by <strong>re</strong>gard<strong>in</strong>g the length of this list, the deg<strong>re</strong>e of the polynomial.<br />

In AsymptoticExpand, we aga<strong>in</strong> calculate the power series, but now to the cor<strong>re</strong>ct order.<br />

The command Normal nally converts the series expansion to a normal exp<strong>re</strong>ssion by<br />

cutt<strong>in</strong>g o the error term that is also <strong>re</strong>turned by Series.<br />

Example 7.4.1 Consider the function f(x) =x+ p x 4 +x 3 ,x+1. The series expansion calculated<br />

to nd the deg<strong>re</strong>e of the polynomial <strong>in</strong>cludes only the highest order terms and an error term.<br />

In[7]:= Series[x+Sqrt[x^4+x^3-x+1],fx,Inf<strong>in</strong>ity,1g]<br />

Out[7]= 2 3 x 1 0<br />

x + --- + O[-]<br />

2 x<br />

The length of the list of coe cients (start<strong>in</strong>g with x 0 ) gives the desi<strong>re</strong>d value.<br />

In[8]:= CoefficientList[%,x]<br />

178

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

Saved successfully!

Ooh no, something went wrong!