11.07.2015 Views

A Quantum Optics Toolbox for Matlab 5

A Quantum Optics Toolbox for Matlab 5

A Quantum Optics Toolbox for Matlab 5

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

A <strong>Quantum</strong> <strong>Optics</strong> <strong>Toolbox</strong> <strong>for</strong> <strong>Matlab</strong> 5 17in a 20 dimensional Fock space. The Wigner and Q functions are computed using the functions wfuncand qfunc at a set of points de…ned by the vectors xvec and yvec which may be chosen arbitrarily.Note that the relationships between x; y and a; a y are assumed to be given bya = g 2 (x + iy) ;ay = g (x ¡ iy)2where g is a constant which may be used to account <strong>for</strong> various de…nitions in use. If the parameter g isomitted in the call to wfunc or to qfunc, thevalueg = p 2 is assumed.N = 20;alpha = input(’alpha = ’);epsilon = input(’epsilon = ’);a = destroy(N);D = expm(alpha*a’-alpha’*a);S = expm(0.5*epsilon’*a^2-0.5*epsilon*(a’)^2);psi = D*S*basis(N,1);g = 2;xvec = [-40:40]*5/40; yvec = xvec;W = wfunc(psi,xvec,yvec,g);figure(1); pcolor(xvec,yvec,real(W));shading interp; title(’Wigner function of squeezed state’);Q = qfunc(psi,xvec,yvec,g);figure(2); pcolor(xvec,yvec,real(Q));shading interp; title(’Q function of squeezed state’);Intheabove,thestate<strong>for</strong>wfunc and <strong>for</strong> qfunc is speci…ed as a ket psi. It is also valid to use adensity matrix to specify the state. The …le xschcat similarly illustrates the calculation of the Wignerand Q functions of a Schrödinger cat state.The operator exponential is also useful <strong>for</strong> generating matrices <strong>for</strong> rotations through …nite angles sincea rotation through Á about the n axis may be written as exp (¡in ¢ JÁ) : This is illustrated in the …lexorbital. The …le rotation is also available <strong>for</strong> converting between descriptions of a rotation speci…edin various <strong>for</strong>mats (as Euler angles, as an axis and an angle, as a 3 £ 3 orthogonal matrix in SO(3) or asa unitary matrix in SO(2)). As an example, try entering rotateworld([pi/3,pi/4,pi/2],’euler’).The …le xrotateworld shows a spinning globe by making successive calls to rotateworld.10. Superoperator AdjointsGiven a superoperator L which acts on a density matrix ½ via the operationL½ = A½Bwhere A and B are operators, we often wish to compute the “superoperator adjoint” e L which is de…nedso that its action on ½ iseL½ = B y ½A ywhere the dagger denotes the adjoints of the operators. In the toolbox, the function sadjoint(L) maybe used to …nd the superoperator adjoint of a quantum object.Hilbert Space Permutation and Calculation of Partial TracesIt is sometimes desirable to re-order the spaces which are multiplied together in a tensor product. Forexample, if we take the product of three operators such as>> A = tensor(destroy(5),jmat(1/2,’x’),destroy(4));the result of this is to produce a matrix with Hilbert space dimensions [5 2 4] by [5 2 4]: The toolboxfunction permute is provided to change the order of the spaces. For example if we enter>> B = permute(A,[3,1,2])the result is to re-order the spaces in A so that B = tensor(destroy(4),destroy(5),jmat(1/2,’x’)).The function permute may be applied to vectors, operators and super-operators.

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

Saved successfully!

Ooh no, something went wrong!