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.

(*<br />

Protect[CurrStat, CurrTrans, Curr, CurrPack]<br />

Protect[VoltStat, VoltTrans, Volt, VoltPack]<br />

*)<br />

EndPackage[]<br />

A.5 Utilities for display<strong>in</strong>g po<strong>in</strong>ts <strong>in</strong> 3D<br />

A Mathematica packages<br />

The Mathematica package Tools3D conta<strong>in</strong>s a number of functions that a<strong>re</strong> needed for the<br />

graphical <strong>re</strong>p<strong>re</strong>sentation of lists of po<strong>in</strong>ts <strong>in</strong> R 3 . Such lists a<strong>re</strong> typically the outcome of surface<br />

computations over a <strong>re</strong>ctangular grid be<strong>in</strong>g obta<strong>in</strong>ed with commands like Table[fx,y,f(x,y)g,<br />

fx,xm<strong>in</strong>,xmax,dxg, fy,ym<strong>in</strong>,ymax,dyg]. The<strong>re</strong>fo<strong>re</strong> all functions <strong>in</strong> this package assume<br />

that the data is given as two-dimensional lists of po<strong>in</strong>ts, like<br />

fffx11,y11,z11g,fx12,y12,z12g, ::: ,fx1n,y1n,z1ngg,<br />

ffx21,y21,z21g,fx22,y22,z22g, ::: ,fx2n,y2n,z2ngg,<br />

.<br />

.<br />

.<br />

.<br />

.<br />

.<br />

.<br />

ffxm1,ym1,zm1g,fxm2,ym2,zm2g, ::: ,fxmn,ymn,zmnggg.<br />

This matrix must be <strong>re</strong>ctangular, so each sublist must have an equal number of members.<br />

Some functions check this property with the statement<br />

Apply[SameQ,Map[Length,t]],<br />

which rst counts the number of elements <strong>in</strong> each row of the list t (by mapp<strong>in</strong>g the operation<br />

Length onto each member of the list; note that these members a<strong>re</strong> aga<strong>in</strong> lists) and then<br />

evaluates if all entries <strong>in</strong> the <strong>re</strong>sult<strong>in</strong>g list a<strong>re</strong> identical. The outcome of this statement is<br />

boolean | if it is False, error messages a<strong>re</strong> generated.<br />

The functions of the package have the follow<strong>in</strong>g goals:<br />

OrderGrid takes an unsorted, at list of th<strong>re</strong>e-dimensional po<strong>in</strong>ts fxi,yi,zig as <strong>in</strong>put<br />

and arranges them <strong>in</strong> the <strong>re</strong>qui<strong>re</strong>d two-dimensional array of po<strong>in</strong>ts. To this end, the<br />

x-values of all po<strong>in</strong>ts ly<strong>in</strong>g on one grid l<strong>in</strong>e must be undisturbed such that they can be<br />

grouped together.<br />

L<strong>in</strong>k3DList is useful whenever a surface is computed <strong>in</strong> mo<strong>re</strong> than one chunk and the<br />

<strong>re</strong>sults a<strong>re</strong> sto<strong>re</strong>d <strong>in</strong> di e<strong>re</strong>nt les. The function <strong>re</strong>qui<strong>re</strong>s a list with the lenames, the<br />

name for the output le, and optionally a path specify<strong>in</strong>g whe<strong>re</strong> the les a<strong>re</strong> located.<br />

The function then checks whether the output le al<strong>re</strong>ady exists | and if so issues a<br />

warn<strong>in</strong>g | befo<strong>re</strong> merg<strong>in</strong>g and sort<strong>in</strong>g the les. The function call is L<strong>in</strong>k3DList[fFFileA",FileB",<br />

::: g,OutFile"].<br />

ReSize <strong>re</strong>arranges a two-dimensional list by tak<strong>in</strong>g only every nth element. Depend<strong>in</strong>g<br />

on whether the <strong>re</strong>duction should be uniform or not, the function can be called with<br />

ReSize[list,n] or ReSize[list,m,n] for leav<strong>in</strong>g every mth row and nth column.<br />

234

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

Saved successfully!

Ooh no, something went wrong!