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.3 Implementation of OscInt and <strong>re</strong>lated functions<br />

the complete list of solutions. We then <strong>re</strong>gard only the <strong>re</strong>al part of the possibly conjugate<br />

complex solutions and <strong>re</strong>turn the largest one, provided it is still larger than the lower limit a.<br />

Thus we haveo= maxfxo;ag.<br />

ext<strong>re</strong>ma = NSolve[zerof'[x] == 0,x,Work<strong>in</strong>gP<strong>re</strong>cision->wp];<br />

If[Length[ext<strong>re</strong>ma] == 0 || ext<strong>re</strong>ma === ffgg, a,<br />

Max[Re[x/.Last[ext<strong>re</strong>ma]],a]]<br />

Remark (Ext<strong>re</strong>ma) To nd the ext<strong>re</strong>ma of (x), we cannot use F<strong>in</strong>dRoot s<strong>in</strong>ce we do<br />

not know whe<strong>re</strong> to start the iteration. Hence we cannot ensu<strong>re</strong> that we obta<strong>in</strong> the largest<br />

solution. This is why wehave to use the slower NSolve. From the code it is also clear that<br />

the function zerof must be di e<strong>re</strong>ntiable. The odd-look<strong>in</strong>g test for ext<strong>re</strong>ma === ffgg<br />

is noth<strong>in</strong>g but the condition 0 (x) 0, because this structu<strong>re</strong> is what NSolve <strong>re</strong>turns to<br />

<strong>in</strong>dicate that the equation is satis ed for all x.<br />

Example 7.3.1 Consider the argument function<br />

(x) =x(x,1+j)(x,1,j)(x,4+j)(x,4,j)<br />

=x , x 4 ,10x 3 +35x 2 ,50x +34 ;<br />

which has no ext<strong>re</strong>mum at all, as the plot shows. Consequently, the rst derivative has two pairs of<br />

conjugate complex zeros, and PartitionOffs <strong>in</strong>deed <strong>re</strong>turns the larger <strong>re</strong>al part of the two.<br />

In[1]:= f[x_] := x (x-1+I) (x-1-I) (x-4+I) (x-4-I)<br />

In[2]:= Plot[f[x],fx,-0.5,4.5g];<br />

60<br />

40<br />

20<br />

-20<br />

1 2 3 4<br />

In[3]:= NSolve[f'[x]==0,x]<br />

Out[3]= ffx -> 0.740373 - 0.294381 Ig,fx -> 0.740373 + 0.294381 Ig,<br />

fx -> 3.25963 - 0.294381 Ig,fx -> 3.25963 + 0.294381 Igg<br />

In[4]:= PartitionOffs[f,0]<br />

Out[4]= 3.25963<br />

169

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

Saved successfully!

Ooh no, something went wrong!