Using Mathematica for Quantum Mechanics a Student’S Manual Arxiv:1403.7050V3 [Quant-Ph] 4 Feb 2019

Total Page:16

File Type:pdf, Size:1020Kb

Using Mathematica for Quantum Mechanics a Student’S Manual Arxiv:1403.7050V3 [Quant-Ph] 4 Feb 2019 PD Dr. Roman Schmied Using Mathematica for Quantum Mechanics A Student’s Manual arXiv:1403.7050v3 [quant-ph] 4 Feb 2019 University of Basel, Switzerland ii © 2012–2019 Roman Schmied. compiled on February 5, 2019 published at https://arxiv.org/abs/1403.7050 This book accompanies a one-semester lecture given yearly at the Department of Physics, University of Basel, Switzerland. The target audience are Master’s and PhD students in physics and related fields. Wolfram Mathematicar, the Wolfram languager, and Wolfram Alphar are registered trademarks of Wolfram Research, Inc. Adober Acrobatr Readerr is a registered trademark of Adobe Systems, Inc. Cover: First light of 2017, Aussichtsturm Liestal, Switzerland. © 2017 Roman Schmied. contents preface vii Why Mathematica? . viii Mathematica source code . viii outline of discussed topics . viii 1 Wolfram language overview1 1.1 introduction . .2 1.1.1 exercises . .2 1.2 variables and assignments . .3 1.2.1 immediate and delayed assignments . .4 1.2.2 exercises . .4 1.3 four kinds of bracketing . .5 1.4 prefix and postfix . .5 1.4.1 exercises . .6 1.5 programming constructs . .6 1.5.1 procedural programming . .6 1.5.2 exercises . .7 1.5.3 functional programming . .8 1.5.4 exercises . .9 1.6 function definitions . .9 1.6.1 immediate function definitions . .9 1.6.2 delayed function definitions . 10 1.6.3 memoization: functions that remember their results . 10 1.6.4 functions with conditions on their arguments . 11 1.6.5 functions with optional arguments . 12 1.7 rules and replacements . 12 1.7.1 immediate and delayed rules . 13 1.7.2 repeated rule replacement . 14 1.8 debugging and finding out how Mathematica expressions are evaluated . 14 1.8.1 exercises . 15 1.9 many ways to define the factorial function . 16 1.9.1 exercises . 18 1.10 vectors, matrices, tensors . 18 1.10.1 vectors . 18 1.10.2 matrices . 19 1.10.3 sparse vectors and matrices . 19 1.10.4 matrix diagonalization . 20 1.10.5 tensor operations . 22 1.10.6 exercises . 23 1.11 complex numbers . 24 1.12 units . 24 2 quantum mechanics: states and operators 27 2.1 basis sets and representations . 28 iii iv CONTENTS 2.1.1 incomplete basis sets . 28 2.1.2 exercises . 29 2.2 time-independent Schrödinger equation . 29 2.2.1 diagonalization . 30 2.2.2 exercises . 30 2.3 time-dependent Schrödinger equation . 30 2.3.1 time-independent basis . 31 2.3.2 time-dependent basis: interaction picture . 32 2.3.3 special case: H^(t); H^(t0) = 0 8(t; t0) ........................ 32 2.3.4 special case: time-independent Hamiltonian . 33 2.3.5 exercises . 33 2.4 basis construction . 33 2.4.1 description of a single degree of freedom . 33 2.4.2 description of coupled degrees of freedom . 34 2.4.3 reduced density matrices . 36 2.4.4 exercises . 38 3 spin and angular momentum 39 3.1 quantum-mechanical spin and angular momentum operators . 40 3.1.1 exercises . 41 3.2 spin-1/2 electron in a dc magnetic field . 41 3.2.1 time-independent Schrödinger equation . 43 3.2.2 exercises . 43 3.3 coupled spin systems: 87Rb hyperfine structure . 43 3.3.1 eigenstate analysis . 45 3.3.2 “magic” magnetic field . 47 3.3.3 coupling to an oscillating magnetic field . 47 3.3.4 exercises . 52 3.4 coupled spin systems: Ising model in a transverse field . 52 3.4.1 basis set . 53 3.4.2 asymptotic ground states . 54 3.4.3 Hamiltonian diagonalization . 54 3.4.4 analysis of the ground state . 55 3.4.5 exercises . 61 3.5 coupled spin systems: quantum circuits . 62 3.5.1 quantum gates . 62 3.5.2 a simple quantum circuit . 65 3.5.3 application: the Quantum Fourier Transform . 66 3.5.4 application: quantum phase estimation . 68 3.5.5 exercises . 70 4 quantum motion in real space 71 4.1 one particle in one dimension . 72 4.1.1 units . 72 4.1.2 computational basis functions . 73 4.1.3 the position operator . 77 4.1.4 the potential-energy operator . 78 4.1.5 the kinetic-energy operator . 78 4.1.6 the momentum operator . 79 4.1.7 example: gravity well . 79 4.1.8 the Wigner quasi-probability distribution . 83 4.1.9 1D dynamics in the square well . 86 4.1.10 1D dynamics in a time-dependent potential . 89 4.2 non-linear Schrödinger equation . 91 4.2.1 ground state of the non-linear Schrödinger equation . 93 4.3 several particles in one dimension: interactions . 95 CONTENTS v 4.3.1 two identical particles in one dimension with contact interaction . 95 4.3.2 two particles in one dimension with arbitrary interaction . 101 4.4 one particle in several dimensions . 102 4.4.1 exercises . ..
Recommended publications
  • The Sagemanifolds Project
    Tensor calculus with free softwares: the SageManifolds project Eric´ Gourgoulhon1, Micha l Bejger2 1Laboratoire Univers et Th´eories (LUTH) CNRS / Observatoire de Paris / Universit´eParis Diderot 92190 Meudon, France http://luth.obspm.fr/~luthier/gourgoulhon/ 2Centrum Astronomiczne im. M. Kopernika (CAMK) Warsaw, Poland http://users.camk.edu.pl/bejger/ Encuentros Relativistas Espa~noles2014 Valencia 1-5 September 2014 Eric´ Gourgoulhon, Micha l Bejger (LUTH, CAMK) SageManifolds ERE2014, Valencia, 2 Sept. 2014 1 / 44 Outline 1 Differential geometry and tensor calculus on a computer 2 Sage: a free mathematics software 3 The SageManifolds project 4 SageManifolds at work: the Mars-Simon tensor example 5 Conclusion and perspectives Eric´ Gourgoulhon, Micha l Bejger (LUTH, CAMK) SageManifolds ERE2014, Valencia, 2 Sept. 2014 2 / 44 Differential geometry and tensor calculus on a computer Outline 1 Differential geometry and tensor calculus on a computer 2 Sage: a free mathematics software 3 The SageManifolds project 4 SageManifolds at work: the Mars-Simon tensor example 5 Conclusion and perspectives Eric´ Gourgoulhon, Micha l Bejger (LUTH, CAMK) SageManifolds ERE2014, Valencia, 2 Sept. 2014 3 / 44 In 1969, during his PhD under Pirani supervision at King's College, Ray d'Inverno wrote ALAM (Atlas Lisp Algebraic Manipulator) and used it to compute the Riemann tensor of Bondi metric. The original calculations took Bondi and his collaborators 6 months to go. The computation with ALAM took 4 minutes and yield to the discovery of 6 errors in the original paper [J.E.F. Skea, Applications of SHEEP (1994)] In the early 1970's, ALAM was rewritten in the LISP programming language, thereby becoming machine independent and renamed LAM The descendant of LAM, called SHEEP (!), was initiated in 1977 by Inge Frick Since then, many softwares for tensor calculus have been developed..
    [Show full text]
  • Using Macaulay2 Effectively in Practice
    Using Macaulay2 effectively in practice Mike Stillman ([email protected]) Department of Mathematics Cornell 22 July 2019 / IMA Sage/M2 Macaulay2: at a glance Project started in 1993, Dan Grayson and Mike Stillman. Open source. Key computations: Gr¨obnerbases, free resolutions, Hilbert functions and applications of these. Rings, Modules and Chain Complexes are first class objects. Language which is comfortable for mathematicians, yet powerful, expressive, and fun to program in. Now a community project Journal of Software for Algebra and Geometry (started in 2009. Now we handle: Macaulay2, Singular, Gap, Cocoa) (original editors: Greg Smith, Amelia Taylor). Strong community: including about 2 workshops per year. User contributed packages (about 200 so far). Each has doc and tests, is tested every night, and is distributed with M2. Lots of activity Over 2000 math papers refer to Macaulay2. History: 1976-1978 (My undergrad years at Urbana) E. Graham Evans: asked me to write a program to compute syzygies, from Hilbert's algorithm from 1890. Really didn't work on computers of the day (probably might still be an issue!). Instead: Did computation degree by degree, no finishing condition. Used Buchsbaum-Eisenbud \What makes a complex exact" (by hand!) to see if the resulting complex was exact. Winfried Bruns was there too. Very exciting time. History: 1978-1983 (My grad years, with Dave Bayer, at Harvard) History: 1978-1983 (My grad years, with Dave Bayer, at Harvard) I tried to do \real mathematics" but Dave Bayer (basically) rediscovered Groebner bases, and saw that they gave an algorithm for computing all syzygies. I got excited, dropped what I was doing, and we programmed (in Pascal), in less than one week, the first version of what would be Macaulay.
    [Show full text]
  • Python – an Introduction
    Python { AN IntroduCtion . default parameters . self documenting code Example for extensions: Gnuplot Hans Fangohr, [email protected], CED Seminar 05/02/2004 ² The wc program in Python ² Summary Overview ² Outlook ² Why Python ² Literature: How to get started ² Interactive Python (IPython) ² M. Lutz & D. Ascher: Learning Python Installing extra modules ² ² ISBN: 1565924649 (1999) (new edition 2004, ISBN: Lists ² 0596002815). We point to this book (1999) where For-loops appropriate: Chapter 1 in LP ² ! if-then ² modules and name spaces Alex Martelli: Python in a Nutshell ² ² while ISBN: 0596001886 ² string handling ² ¯le-input, output Deitel & Deitel et al: Python { How to Program ² ² functions ISBN: 0130923613 ² Numerical computation ² some other features Other resources: ² . long numbers www.python.org provides extensive . exceptions ² documentation, tools and download. dictionaries Python { an introduction 1 Python { an introduction 2 Why Python? How to get started: The interpreter and how to run code Chapter 1, p3 in LP Chapter 1, p12 in LP ! Two options: ! All sorts of reasons ;-) interactive session ² ² . Object-oriented scripting language . start Python interpreter (python.exe, python, . power of high-level language double click on icon, . ) . portable, powerful, free . prompt appears (>>>) . mixable (glue together with C/C++, Fortran, . can enter commands (as on MATLAB prompt) . ) . easy to use (save time developing code) execute program ² . easy to learn . Either start interpreter and pass program name . (in-built complex numbers) as argument: python.exe myfirstprogram.py Today: . ² Or make python-program executable . easy to learn (Unix/Linux): . some interesting features of the language ./myfirstprogram.py . use as tool for small sysadmin/data . Note: python-programs tend to end with .py, processing/collecting tasks but this is not necessary.
    [Show full text]
  • Rapid Research with Computer Algebra Systems
    doi: 10.21495/71-0-109 25th International Conference ENGINEERING MECHANICS 2019 Svratka, Czech Republic, 13 – 16 May 2019 RAPID RESEARCH WITH COMPUTER ALGEBRA SYSTEMS C. Fischer* Abstract: Computer algebra systems (CAS) are gaining popularity not only among young students and schol- ars but also as a tool for serious work. These highly complicated software systems, which used to just be regarded as toys for computer enthusiasts, have reached maturity. Nowadays such systems are available on a variety of computer platforms, starting from freely-available on-line services up to complex and expensive software packages. The aim of this review paper is to show some selected capabilities of CAS and point out some problems with their usage from the point of view of 25 years of experience. Keywords: Computer algebra system, Methodology, Wolfram Mathematica 1. Introduction The Wikipedia page (Wikipedia contributors, 2019a) defines CAS as a package comprising a set of algo- rithms for performing symbolic manipulations on algebraic objects, a language to implement them, and an environment in which to use the language. There are 35 different systems listed on the page, four of them discontinued. The oldest one, Reduce, was publicly released in 1968 (Hearn, 2005) and is still available as an open-source project. Maple (2019a) is among the most popular CAS. It was first publicly released in 1984 (Maple, 2019b) and is still popular, also among users in the Czech Republic. PTC Mathcad (2019) was published in 1986 in DOS as an engineering calculation solution, and gained popularity for its ability to work with typeset mathematical notation in combination with automatic computations.
    [Show full text]
  • Dirac Notation Frank Rioux
    Elements of Dirac Notation Frank Rioux In the early days of quantum theory, P. A. M. (Paul Adrian Maurice) Dirac created a powerful and concise formalism for it which is now referred to as Dirac notation or bra-ket (bracket ) notation. Two major mathematical traditions emerged in quantum mechanics: Heisenberg’s matrix mechanics and Schrödinger’s wave mechanics. These distinctly different computational approaches to quantum theory are formally equivalent, each with its particular strengths in certain applications. Heisenberg’s variation, as its name suggests, is based matrix and vector algebra, while Schrödinger’s approach requires integral and differential calculus. Dirac’s notation can be used in a first step in which the quantum mechanical calculation is described or set up. After this is done, one chooses either matrix or wave mechanics to complete the calculation, depending on which method is computationally the most expedient. Kets, Bras, and Bra-Ket Pairs In Dirac’s notation what is known is put in a ket, . So, for example, p expresses the fact that a particle has momentum p. It could also be more explicit: p = 2 , the particle has momentum equal to 2; x = 1.23 , the particle has position 1.23. Ψ represents a system in the state Q and is therefore called the state vector. The ket can also be interpreted as the initial state in some transition or event. The bra represents the final state or the language in which you wish to express the content of the ket . For example,x =Ψ.25 is the probability amplitude that a particle in state Q will be found at position x = .25.
    [Show full text]
  • Introduction to GNU Octave
    Introduction to GNU Octave Hubert Selhofer, revised by Marcel Oliver updated to current Octave version by Thomas L. Scofield 2008/08/16 line 1 1 0.8 0.6 0.4 0.2 0 -0.2 -0.4 8 6 4 2 -8 -6 0 -4 -2 -2 0 -4 2 4 -6 6 8 -8 Contents 1 Basics 2 1.1 What is Octave? ........................... 2 1.2 Help! . 2 1.3 Input conventions . 3 1.4 Variables and standard operations . 3 2 Vector and matrix operations 4 2.1 Vectors . 4 2.2 Matrices . 4 1 2.3 Basic matrix arithmetic . 5 2.4 Element-wise operations . 5 2.5 Indexing and slicing . 6 2.6 Solving linear systems of equations . 7 2.7 Inverses, decompositions, eigenvalues . 7 2.8 Testing for zero elements . 8 3 Control structures 8 3.1 Functions . 8 3.2 Global variables . 9 3.3 Loops . 9 3.4 Branching . 9 3.5 Functions of functions . 10 3.6 Efficiency considerations . 10 3.7 Input and output . 11 4 Graphics 11 4.1 2D graphics . 11 4.2 3D graphics: . 12 4.3 Commands for 2D and 3D graphics . 13 5 Exercises 13 5.1 Linear algebra . 13 5.2 Timing . 14 5.3 Stability functions of BDF-integrators . 14 5.4 3D plot . 15 5.5 Hilbert matrix . 15 5.6 Least square fit of a straight line . 16 5.7 Trapezoidal rule . 16 1 Basics 1.1 What is Octave? Octave is an interactive programming language specifically suited for vectoriz- able numerical calculations.
    [Show full text]
  • Dirac Equation - Wikipedia
    Dirac equation - Wikipedia https://en.wikipedia.org/wiki/Dirac_equation Dirac equation From Wikipedia, the free encyclopedia In particle physics, the Dirac equation is a relativistic wave equation derived by British physicist Paul Dirac in 1928. In its free form, or including electromagnetic interactions, it 1 describes all spin-2 massive particles such as electrons and quarks for which parity is a symmetry. It is consistent with both the principles of quantum mechanics and the theory of special relativity,[1] and was the first theory to account fully for special relativity in the context of quantum mechanics. It was validated by accounting for the fine details of the hydrogen spectrum in a completely rigorous way. The equation also implied the existence of a new form of matter, antimatter, previously unsuspected and unobserved and which was experimentally confirmed several years later. It also provided a theoretical justification for the introduction of several component wave functions in Pauli's phenomenological theory of spin; the wave functions in the Dirac theory are vectors of four complex numbers (known as bispinors), two of which resemble the Pauli wavefunction in the non-relativistic limit, in contrast to the Schrödinger equation which described wave functions of only one complex value. Moreover, in the limit of zero mass, the Dirac equation reduces to the Weyl equation. Although Dirac did not at first fully appreciate the importance of his results, the entailed explanation of spin as a consequence of the union of quantum mechanics and relativity—and the eventual discovery of the positron—represents one of the great triumphs of theoretical physics.
    [Show full text]
  • Books About Computing Tools
    Books about Programming and Computing Tools Separate Section of: Books about Computing, Programming, Algorithms, and Software Development Collection of References edited by Stanislav Sýkora Permalink via DOI: 10.3247/SL6Refs16.001 Stan's LIBRARY and its Programming Section Extra Byte | Stan's HUB Free online texts Forward a missing book reference Site Plan & SEARCH This growing compilation includes titles yet to be released (they have a month specified in the release date). The entries are sorted by publication year and the first Author. Green-color titles indicate educational texts. You can download a PDF version of this document for off-line use. But keep coming back, the list is growing! Many of the books are available from Amazon. Entering Amazon from here helps this site at no cost to you. F Other Lists: Popular Science F Mathematics F Physics F Chemistry Visitor # Patents+IP F Electronics | DSP | Tinkering F Computing Spintronics F Materials ADVERTISE with us WWW issues F Instruments / Measurements Quantum Computing F NMR | ESR | MRI F Spectroscopy Extra Byte Hint: the F symbols above, where present, are links to free online texts (books, courses, theses, ...) Advance notices (years ≥ 2016) and, at page bottom, Related Works: Link Directories: SCIENCE | Edu+Fun 1. Garvan Frank, MATH | COMPUTING The Maple Book, PHYSICS | CHEMISTRY 2nd Edition, Chapman and Hall/CRC, February 2016. ISBN 978-1439898286. Hardcover >>. NMR-MRI-ESR-NQR 2. Green Dale, ELECTRONICS Procedural Content Generation for C++ Game Development, PATENTS+IP Packt Publishing, March 2016. Kindle >>. WWW stuff 3. Guido Sarah, Introduction to Machine Learning with Python, Other resources: O'Reilly Media, January 2016.
    [Show full text]
  • Singular Value Decomposition and Its Numerical Computations
    Singular Value Decomposition and its numerical computations Wen Zhang, Anastasios Arvanitis and Asif Al-Rasheed ABSTRACT The Singular Value Decomposition (SVD) is widely used in many engineering fields. Due to the important role that the SVD plays in real-time computations, we try to study its numerical characteristics and implement the numerical methods for calculating it. Generally speaking, there are two approaches to get the SVD of a matrix, i.e., direct method and indirect method. The first one is to transform the original matrix to a bidiagonal matrix and then compute the SVD of this resulting matrix. The second method is to obtain the SVD through the eigen pairs of another square matrix. In this project, we implement these two kinds of methods and develop the combined methods for computing the SVD. Finally we compare these methods with the built-in function in Matlab (svd) regarding timings and accuracy. 1. INTRODUCTION The singular value decomposition is a factorization of a real or complex matrix and it is used in many applications. Let A be a real or a complex matrix with m by n dimension. Then the SVD of A is: where is an m by m orthogonal matrix, Σ is an m by n rectangular diagonal matrix and is the transpose of n ä n matrix. The diagonal entries of Σ are known as the singular values of A. The m columns of U and the n columns of V are called the left singular vectors and right singular vectors of A, respectively. Both U and V are orthogonal matrices.
    [Show full text]
  • An Alternative Algorithm for Computing the Betti Table of a Monomial Ideal 3
    AN ALTERNATIVE ALGORITHM FOR COMPUTING THE BETTI TABLE OF A MONOMIAL IDEAL MARIA-LAURA TORRENTE AND MATTEO VARBARO Abstract. In this paper we develop a new technique to compute the Betti table of a monomial ideal. We present a prototype implementation of the resulting algorithm and we perform numerical experiments suggesting a very promising efficiency. On the way of describing the method, we also prove new constraints on the shape of the possible Betti tables of a monomial ideal. 1. Introduction Since many years syzygies, and more generally free resolutions, are central in purely theo- retical aspects of algebraic geometry; more recently, after the connection between algebra and statistics have been initiated by Diaconis and Sturmfels in [DS98], free resolutions have also become an important tool in statistics (for instance, see [D11, SW09]). As a consequence, it is fundamental to have efficient algorithms to compute them. The usual approach uses Gr¨obner bases and exploits a result of Schreyer (for more details see [Sc80, Sc91] or [Ei95, Chapter 15, Section 5]). The packages for free resolutions of the most used computer algebra systems, like [Macaulay2, Singular, CoCoA], are based on these techniques. In this paper, we introduce a new algorithmic method to compute the minimal graded free resolution of any finitely generated graded module over a polynomial ring such that some (possibly non- minimal) graded free resolution is known a priori. We describe this method and we present the resulting algorithm in the case of monomial ideals in a polynomial ring, in which situ- ation we always have a starting nonminimal graded free resolution.
    [Show full text]
  • Gretl User's Guide
    Gretl User’s Guide Gnu Regression, Econometrics and Time-series Allin Cottrell Department of Economics Wake Forest university Riccardo “Jack” Lucchetti Dipartimento di Economia Università Politecnica delle Marche December, 2008 Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation (see http://www.gnu.org/licenses/fdl.html). Contents 1 Introduction 1 1.1 Features at a glance ......................................... 1 1.2 Acknowledgements ......................................... 1 1.3 Installing the programs ....................................... 2 I Running the program 4 2 Getting started 5 2.1 Let’s run a regression ........................................ 5 2.2 Estimation output .......................................... 7 2.3 The main window menus ...................................... 8 2.4 Keyboard shortcuts ......................................... 11 2.5 The gretl toolbar ........................................... 11 3 Modes of working 13 3.1 Command scripts ........................................... 13 3.2 Saving script objects ......................................... 15 3.3 The gretl console ........................................... 15 3.4 The Session concept ......................................... 16 4 Data files 19 4.1 Native format ............................................. 19 4.2 Other data file formats ....................................... 19 4.3 Binary databases ..........................................
    [Show full text]
  • Automated Likelihood Based Inference for Stochastic Volatility Models H
    View metadata, citation and similar papers at core.ac.uk brought to you by CORE provided by Institutional Knowledge at Singapore Management University Singapore Management University Institutional Knowledge at Singapore Management University Research Collection School Of Economics School of Economics 11-2009 Automated Likelihood Based Inference for Stochastic Volatility Models H. Skaug Jun YU Singapore Management University, [email protected] Follow this and additional works at: https://ink.library.smu.edu.sg/soe_research Part of the Econometrics Commons Citation Skaug, H. and YU, Jun. Automated Likelihood Based Inference for Stochastic Volatility Models. (2009). 1-28. Research Collection School Of Economics. Available at: https://ink.library.smu.edu.sg/soe_research/1151 This Working Paper is brought to you for free and open access by the School of Economics at Institutional Knowledge at Singapore Management University. It has been accepted for inclusion in Research Collection School Of Economics by an authorized administrator of Institutional Knowledge at Singapore Management University. For more information, please email [email protected]. Automated Likelihood Based Inference for Stochastic Volatility Models Hans J. SKAUG , Jun YU November 2009 Paper No. 15-2009 ANY OPINIONS EXPRESSED ARE THOSE OF THE AUTHOR(S) AND NOT NECESSARILY THOSE OF THE SCHOOL OF ECONOMICS, SMU Automated Likelihood Based Inference for Stochastic Volatility Models¤ Hans J. Skaug,y Jun Yuz October 7, 2008 Abstract: In this paper the Laplace approximation is used to perform classical and Bayesian analyses of univariate and multivariate stochastic volatility (SV) models. We show that imple- mentation of the Laplace approximation is greatly simpli¯ed by the use of a numerical technique known as automatic di®erentiation (AD).
    [Show full text]