Undergraduate Quantum Mechanics: a Numerical Approach Using Qutip

Undergraduate Quantum Mechanics: a Numerical Approach Using Qutip

Undergraduate Quantum Mechanics: a Numerical Approach using QuTiP Andrew M.C. Dawes∗ Department of Physics, Pacific University, Forest Grove, OR 97116 (Dated: October 1, 2019) We present an introduction to the Quantum Toolbox in Python (QuTiP) in the context of an undergraduate quantum mechanics class and potential senior research projects. QuTiP provides ready-to-use definitions of standard quantum states and operators as well as numerous dynamic solvers and tools for visualization. The quantum systems described here are typical for an under- graduate curriculum and range from two-state systems to optical interaction with multilevel atoms. I. INTRODUCTION from code reuse and conceptual recycling when moving between these topics. Quantum mechanics has undergone substantial ped- Photon polarization states are represented by vectors agogical evolution in response to Physics Education in an 2-dimensional space. Starting with small vectors Research (PER) results and advances in laboratory and matrices allows simultaneous calculation by-hand technology.1 The development of a specialized framework and via computer. In the context of teaching, this is for computational calculation in quantum mechanics pro- useful for verification during the orientation phase and vides a valuable addition that we encourage instructors to catch numerical errors while students learn a new sys- to add to their courses. Our goal is to present several tem. Later, students develop their own habits of verifica- ways computational techniques can be added to existing tion and learn ways to check their work for larger Hilbert courses in quantum mechanics. A distinct advantage of spaces. this approach is that the computational framework in- Python is an object-oriented language which for our cludes research-grade tools that enable advanced prob- purposes means that quantum states are represented by lem solving for senior undergraduates and even graduate an object. Other pre-defeined functions can operate on students. these objects, and we can define our own operations as We note that this approach may be most natural for discussed below. The most fundamental object in QuTiP courses that emphasize matrix mechanics early in the is the Qobj. Instances of Qobj have many useful prop- course as vector and matrix methods are the most nat- erties. Primarily, they are a matrix (or vector) imple- ural representations in numerical work. The order of mented efficiently in Python. The features most relevant the specific examples presented here follows the textbook to this work are the indication of their status as either Quantum Mechanics: Theory and Experiment by Mark bra or ket, and whether they are Hermitian operators Beck1 which starts with photon polarization states and or not. We will not make much use of the other prop- spin states then moves to one-dimensional potentials and erties, and for the most part, these properties are used time dependent states. Many courses follow a similar internally for type-checking and other verification. Sev- progression, and the tools we describe are useful in other eral important functions create frequently-used quantum contexts as well. Even a course starting with wave me- objects. One of the most fundamental functions creates chanics can make use of these examples once spin states basis vectors. The function basis takes a dimension, N, and matrix methods are introduced. and an index as its arguments. For two-state systems, We present results using a specific computational N = 2 and we have two basis vectors: basis(2,0) and 1 framework called QuTiP (the Quantum Toolbox in basis(2,1) which represent the column vectors and Python). The QuTiP computational framework was re- 0 leased in 2011 with additional versions and updates in 0 respectively.6 We demonstrate these and many other the years following.2,3 The examples here have been de- 1 veloped using version 4.2. In addition to QuTiP, we rec- features in the following sections. ommend using Jupyter notebooks which provide an inter- Before presenting sample code, it is important to arXiv:1909.13651v1 [physics.ed-ph] 19 Sep 2019 active python computing environment.4,5 The notebook note that while a stock python environment is quite interface allows instructors to create interactive lessons functional, it does not include some features we use and for students to document their work in-place. throughout the following examples. To add these fea- tures, we import from the qutip, numpy, and matplotlib packages:7{9 II. PHOTON POLARIZATION STATES Listing 1. Module imports used for code samples presented. Our first example system uses photon polarization from qutip import* states in parallel with the text and associated experi- from numpy import sqrt, pi, array, sin, cos, arange ments presented by Beck.1 Given the similarity of the ma- import matplotlib.pyplot as plt trix representation of all two-state systems, users benefit %matplotlib inline 2 The last line is only useful in a Jupyter Notebooks, it of a polarization state by a given angle. Defined as enables inline figures. For a two-level system, the basis states themselves can cos θ sin θ R^p(θ) = − ; (3) serve as horizontal ( H ) and vertical ( V ) polarization sin θ cos θ states or as spin-upj ( +i z ) and spin-downj i ( z ). For the rotation matrix implementation is given in Listing 4. now, we use polarizationj states.i In parallel withj − thei no- We use a short python function to create the matrix for tation of Beck1, we can define three pairs of polarization a given angle theta. The function returns a Qobj that states via code shown in Listing 2. Note, these are all has been processed with the .tidyup() which removes written in the HV basis; a point we make as it is impor- any very small elements from the returned Qobj. This tant to be aware of the basis any time a vector or matrix is often useful as numerical artifacts from the finite pre- is used to represent a quantum state.10 cision of the computer may accumulate if operators are 11 Listing 2. Definitions of basis states for the three standard used repeatedly. photon polarizations represented in the HV-basis. Listing 4. 2x2 polarization rotation operator. H = basis(2,0) V = basis(2,1) def Rp(theta): P45 = 1/sqrt(2)*(H + V) M = [[cos(theta),-sin(theta)], M45 = 1/sqrt(2)*(H - V) [sin(theta),cos(theta)]] R = 1/sqrt(2)*(H - 1j*V) return Qobj(M).tidyup() L = 1/sqrt(2)*(H + 1j*V) The photon states are also a good place to practice Photon polarization states are a particularly good matrix operations such as change-of-basis. QuTiP han- starting point in the pedagogical sense as students can dles matrix operations in a straightforward way making relate their understanding to observations from optics it easy to perform transformation operations. As an ex- experiments and the vector nature of polarization. With ample, we define the similarity transform used to change these states defined, we can explore basic matrix me- from one basis to another (Listing 5). This is another ex- chanics. Inner products such as H V are computed by ample of a python function written to generate a matrix. converting the ket H into theh braj iH using the dag- In this case, we generate the matrix that transforms a ger .dag() methodj whichi is definedh forj all instances of state from one basis to another. As inputs, the function Qobj. As we would expect for orthogonal vectors, the takes four vectors: the two old basis vectors and the two inner product H V = 0. In QuTiP/python, H.dag()*V new basis vectors. Looking inside the function, we see an returns 0. h j i example of an outer product: new1.dag() * old1. The We make futher use of the .dag() method to create .dag() again method converts a ket to a bra in order projection operators: to carry out inner products such as: new1 old1 . The last two lines of the function extract theh valuej ofi each of P^H = H H (1) the four inner products a,b,c,d and assemble them into j ih j P^ = V V ; (2) a Qobj matrix. The full output of this function is the V j ih j matrix which can be used to project a state into either horizion- : new1 old1 new1 old2 tal or vertical polarization. In this way, they represent S¯ = h j i h j i : (4) new2 old1 new2 old2 physical operation of passing light through a polarizer. h j i h j i The QuTiP implementation of these projection operators is given in Listing 3. As a simple calculation example, Listing 5. Definitions of basis states for the three standard one can calculate P^V +45 which represents the photon photon polarizations represented in the HV-basis. state that would resultj fromi passing light polarized at ◦ def sim_transform(old1, old2, new1, new2): +45 through a vertical polarizer. The computational ''' representation is as simple as declaring psi = P45 and Form the similarity transform from one 0 basis to another. operating on psi with Pv: Pv*psi yields , as 0:707 ''' expected. # Calculate the relevant inner products: Listing 3. Projection operators for horizontal and vertical a = new1.dag()*old1 polarization. b = new1.dag()*old2 c = new2.dag()*old1 Ph = H*H.dag() d = new2.dag()*old2 Pv = V*V.dag() # extract values from these Qobj inner Another example of a simple matrix operation that is # product results, reshape to2 by 2, and readily implemented in QuTiP is the polarization rota- # forma new Qobj matrix: tion matrix. This operator corresponds to the rotation s = [i.data[0,0] fori in [a,b,c,d]] 3 return Qobj(array(s).reshape(2,2)) and y.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    11 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us