10.02.2013 Views

Diploma thesis

Diploma thesis

Diploma thesis

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.

��package with useful functions for Schmidt decompositions with Mathematica��<br />

BeginPackage�"wmschmidt‘"�<br />

getOpt�name�,opts���,func��:�Module���,Return�name�.�opts��.Options�func���;<br />

��ListIntegrate2D�data�List,�dx�,dy���:�ListIntegrate�Map�ListIntegrate��,dy�&,data�,dx�;��<br />

convertDomain�doConv�,val�,iniDom�,destDom��:�convertDomain�doConv,val,iniDom,destDom��Return<br />

�� Convert a discrete representation of a function back into an object which looks like a regular<br />

function to Mathematica. x,y denote to coordinates, range defines the function domain as<br />

�startX, endX, startY, endY�, steps � �stepsX, stepsY� gives the number of cells in each<br />

grid direction, and data carries the array with the discrete function values. ��<br />

convertMatrixToFunction�x�, y�, range�, steps�, data�� :�<br />

Module��n,m, startX, endX, startY, endY, stepsX, stepsY�,<br />

startX � range��1��;<br />

endX � range��2��;<br />

startY � range��3��;<br />

endY� range��4��;<br />

stepsX � steps��1��;<br />

stepsY � steps��2��;<br />

n � Round��x�startX����endX�startX���stepsX�1����1;<br />

m � Round��y�startY����endY�startY���stepsY�1����1;<br />

��Print�"Looking up �", n, ", ", m, "�"�; ��<br />

Return�data��n,m���;<br />

�;<br />

�� Convert a function into a discrete representation. steps and range are defined as above, fn<br />

is a funcion of two arguments, i.e., z � f�x,y�. ��<br />

convertFunctionToMatrix�range�, steps�, fn�� :�convertFunctionToMatrix�range, steps, fn� �<br />

Module��startX, endX, startY, endY, stepsX, stepsY�,<br />

startX � range��1��;<br />

endX � range��2��;<br />

startY � range��3��;<br />

endY� range��4��;<br />

stepsX � steps��1��;<br />

stepsY � steps��2��;<br />

Return�Table�fn�startX � n��endX�startX��stepsX,startY � m��endY�startY��stepsY�, �n,1,stepsY<br />

�;<br />

�� A wrapper function which can be used where a function with signature z � func�x,y� is expected<br />

convertM2FWrap�range�, steps�, data�� :�Function ��x,y�, convertMatrixToFunction�x,y,range,steps<br />

�� Define some orthogonal polynomials: Hermite �normH�, Legendre�normL�, TODO: More ��<br />

�� TODO: Use more reasonable function names ��<br />

normH�n�, x�� :� Exp��x^2�2��1�Sqrt�2^n�n��Sqrt�Pi���HermiteH�n,x�;<br />

normL�n�, x�� :� Sqrt��2n�1��2��LegendreP�n,x�;<br />

�� Given a basis of a �separable� Hilbert space indexed by n, this procedure computes the overlap<br />

� dx� dy Subscript�e^�, m��x�Subscript�e^�, m��y�psi�x,y�. By default, Hermite polynomials with<br />

weight are used as basis functions on an infinite carrier. Setting the optional argument<br />

basisFn allows to specify a different set of basis functions which are expected to be<br />

of the from basis�m,x� where m is an integer argument denoting the m^th basis element and x is<br />

continuous on the carrier. �All options described in the following are optional�.<br />

If convertDomain is set to True, compact carriers for the function psi and the basis are used<br />

Both carriers need not be identical. If, for instance, Legendre polynomials are used, the basis<br />

domain will range from �1 to 1, i.e., basisDomain����1,1�. If a function defined on the<br />

compact carrier �0,5� is supposed to be integrated, funcDomain���0,5� needs to be specified.

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

Saved successfully!

Ooh no, something went wrong!