<<

American University in Cairo AUC Knowledge Fountain

Capstone and Graduation Projects Student Research

Winter 12-30-2020

Quantum Simulation of the Schrodinger Equation using IBM's Computers

Mohamed Abouelela [email protected]

Follow this and additional works at: https://fount.aucegypt.edu/capstone

Part of the Quantum Physics Commons

Recommended Citation Abouelela, Mohamed, "Quantum Simulation of the Schrodinger Equation using IBM's Quantum Computers" (2020). Capstone and Graduation Projects. 20. https://fount.aucegypt.edu/capstone/20

This Dissertation/Thesis is brought to you for free and open access by the Student Research at AUC Knowledge Fountain. It has been accepted for inclusion in Capstone and Graduation Projects by an authorized administrator of AUC Knowledge Fountain. For more information, please contact [email protected]. Quantum Simulation of the Schr¨odingerEquation using IBM’s Quantum Computers

by

Mohamed Abouelela

A Thesis Presented for the Bachelor of Science in Physics

Thesis Advisor: Dr. Tarek El Sayed

Department of Physics American University in Cairo Egypt, December 2020 Contents

List of Figures 3

List of Tables 3

Abstract 5

1 Introduction 6

2 Quantum Computation 7 2.1 ...... 7 2.2 Quantum Gates and Quantum ...... 8 2.3 Bernstein-Vazirani Algorithm ...... 11 2.3.1 The Algorithm ...... 11 2.3.2 Running on QASM and IBMq ...... 13

3 Quantum Simulation 15 3.1 Initialisation ...... 15 3.2 Time-Dependant Schr¨odingerEquation ...... 15 3.2.1 Quantum ...... 16 3.2.2 Momentum ...... 19 3.2.3 Algorithm Overview ...... 21

4 Results 22 4.1 Infinite Square Well ...... 22 4.2 Free Particle ...... 24 4.3 Particle in a Step Potential ...... 25 4.4 Quantum Tunneling ...... 27 4.4.1 Barrier Through the |x111xxi Bases ...... 29 4.4.2 Barrier Through the |x11xxxi Bases ...... 30

5 Running 4- Simulations on ibm vigo 31 5.1 Infinite Square Well ...... 31 5.1.1 QASM ...... 31 5.1.2 ibmq vigo ...... 31 5.2 Free Particle ...... 32 5.2.1 QASM ...... 32 5.2.2 ibmq vigo ...... 32 5.3 Particle in a Step Potential ...... 33 5.3.1 QASM ...... 33 5.3.2 ibmq vigo ...... 33 5.4 Quantum Tunneling ...... 34 5.4.1 QASM ...... 34 5.4.2 ibmq vigo ...... 34

6 Discussion & Conclusion 35

References 36

Appendix 1 38 List of Figures

1 The state of a qubit can be represented in the image of a Bloch Sphere. This can be easily  θ  iφ  θ  interpreted by the more general form of the wavefunction: |ψi = cos 2 |0i + e sin 2 |1i, where θ is the polar angle that determines the of the measurement, and φ is the az- imuthal angle known as the phase, which has no effect on the probabilities of the measurement. Figure courtesy of Nielsen. 1 ...... 7 2 A schematic of the CNOT Gate. The control is represented by a dot, while the target is box with the ’+’ ...... 10 3 The quantum circuit of Bernstein-Vazirani’s Algorithm...... 11 4 A quantum circuit representation of the unitary property of the Hadamard gate...... 12 5 The oracle acting on an input |xi ...... 13 6 Histogram produced by QASM and IBM’s quantum computer [20 pt] ...... 14 Quantum circuit implementation of the QFT, where φ = 2πi . Figure 1 7 N 2N ...... 18 8 Quantum Fourier Transform followed by its inverse. Notice how φ is negative in the inverse QFT. Figure courtesy of Nielsen and Chang 1 ...... 19 1 9 Quantum circuit simulating the Hamiltonian H = Z1 ⊗ Z2 ⊗ Z3 as shown by Nielsen . . . . 20 10 The for a 3-qubit system...... 20 11 Quantum circuit representation of the time evolution operator for a single time step...... 21 12 A visualisation of the 6-qubit initialisation of the half sine with the potential at half of the simulation space ...... 23 13 Results from QASM: Left-hand side showing the initial state, right-hand side showing state after 15 iterations ...... 23 14 The Gaussian curve that will be initialised onto the qubits, with µ = 0 and σ = 0.4 . . . . . 24 15 Three different states of the free particle as measured by QASM with a ∆t = 0.3 ...... 24 16 Three different states of the particle in a step potential of V = 2 simulation as measured by QASM with ∆t = 0.1 ...... 25 17 Three different states of the particle in a step potential of V = 3 simulation as measured by QASM with ∆t = 0.1 ...... 25 18 Three different states of the particle in a step potential of V = 5 simulation as measured by QASM with ∆t = 0.1 ...... 26 19 A potential barrier with the incident particle energy below the potential barrier height 2 [10 pt] 27 20 An incident sinusoidal wavefunciton quantum tunneling through a barrier. The wavefunciton exponentially decays within the potential barrier. 2 [10 pt] ...... 28 21 Three different states of the quantum particle tunneling through a potential barrier of height V = 1.75...... 29 22 Three different states of the quantum particle tunneling through a potential barrier of height V = 1.75...... 30 23 Two states of the eigenstate in an infinite well simulation as measured by QASM with ∆t = 0.1 31 24 Two states of the eigenstate in an infinite well simulation as measured by ibmq vigo with ∆t = 0.1 ...... 31 25 Three states of the free particle simulation as measured by QASM with ∆t = 0.1 ...... 32 26 Three states of the free particle simulation as measured by ibmq vigo with ∆t = 0.1 . . . . . 32 27 Three states of the step potential simulation at V = 2 as measured by the QASM simulator with ∆t = 0.1 ...... 33 28 Three states of the step potential simulation with V = 2 as measured by ibmq vigo with ∆t = 0.1 33

2 29 Three states of the quantum tunneling simulation with V = 1.75 as measured by the QASM simulator with ∆t = 0.1 ...... 34 30 Three states of the quantum tunneling simulation with V = 1.75 as measured by ibmq vigo with ∆t = 0.1 ...... 34

31 A 6-qubit implementation of the Quantum Fourier Transform. Note that the q0 is the ancillary qubit...... 38

32 A 6-qubit implementation of the Inverse Quantum Fourier Transform. Note that the q0 is the ancillary qubit...... 38

33 A 6-qubit implementation of the momentum operator with φ = π. Note that the q0 is the ancillary qubit ...... 39 34 The potential used for the 6-qubit simulation, to apply a potential V on the highest order qubit. 40 35 A filter for the states |x111xxi. The Toffoli gate’s controls are two of the 2nd, 3rd, or 4th highest order qubits, and its target is the ancillary qubit. The controlled phase gate’s control is the ancillary qubit, while the target is the remaining high order qubit from the stated three. . . 40 36 A filter for the states |x11xxxi. The CNOT gates’ control is on the 3rd highest order qubit, and its target is the ancillary qubit. The controlled phase gate’s control is the ancillary qubit, while the target is the 5th highest order qubit...... 41

List of Tables

1 List of commonly used quantum gates. Row 1: Hadamard Gate - NOT Gate. Row 2: Phase Gate - Controlled Phase Gate. Row 3: Controlled NOT Gate - Controlled Controlled NOT (Toffoli) Gate ...... 10

3 Acknowledgements

I am profoundly grateful to have had Dr. Tarek Elsayed as my thesis advisor. I would like to thank him for his patience, and for putting so much effort in teaching me something new, giving me the opportunity to research and unlock a new passion I never knew I had.

I would also like to thank my colleague, Mohamed Eltohfa, for helping me throughout this period as my thesis partner. I would like to thank for teaching me to look at problems through other perspectives.

I would like to thank the every professor in the physics department at AUC for having a strong impact on me as a student and continue to push me forward to reach my goals: Dr. Mohamed Swillam, Dr. Mohammad Alfiky, Dr. Ashraf Alfiky, Dr. Ahmed Hamed, Dr. Nageh Allam, Dr. Amr Shaarawi, Dr. Salah Elsheikh, Dr. Hosny Omar, Dr. Karim Addas, Dr. Mo- hamed Orabi, and Dr. Ezzeldin Soliman.

I thank Miss Lobna Abdelrehim and Farah Lotfy for guiding throughout my years at uni- versity. Their impact was truly great.

I would like to thank my family for their continued emotional support and their belief in following my dreams and passion.

Finally I would like to thank my friends that I have made along the away. Their support is truly appreciated.

4 Abstract

This thesis explores the capabilities of a quantum computer to simulate quantum systems. We give an introduction to the basics of with the Bernstein-Vazirani algorithm as a demonstration. Four quantum systems are then simulated using IBM’s QASM simulator using 6 qubits: the free particle, eigenstate of an infinite-well, particle in a step potential, and quantum tunneling. Because of the high number of gates, a 6-qubit simulation will not be feasible on current quantum computers. The number of qubits was, thus, reduced to 4 qubits, and was simulated on IBM’s 5 qubit quantum computers (ibmq 5 vigo). We conclude that quantum simulations on quantum computers are theoretically achievable, as shown by the QASM simulator; however, no useful information can be extracted using the real quantum computers, due to high noise and high errors.

5 1 Introduction

In his 1982 paper Simulating Physics with Computers, popularised the idea of a non-Turing machine that would simulate quantum systems. 3 This non-Turing machine, as he would describe, would be the quantum computer. His idea was motivated by the existent diffi- culties, and the inability to get an exact solution to a quantum mechanical problem. The general concept is to let a quantum mechanical system simulate another quantum mechanical system. Throughout the 1990s several algorithms have been developed by scientists that demonstrate a quantum computer’s ability to run simulations much more efficiently than that of classical computers. Shor’s factorisation algorithm 4, Grover’s search algorithm 5, and Deutsch-Jozsa’s oracle algorithm 6 are a few examples.

Over the past few years, there has been a deep interest within the scientific community over quantum computers as companies like Google, IBM, Rigetti, and D-Wave proceeded to build their quantum computers. The goal is to build a computer with more qubits that suffers less from decoherence. Such a goal is required to achieve , which is the ability of a quantum device to perform a computational task that a classical computer is not realistically capable of performing 7. In 2018, researchers at Google published a paper where they demon- strated how quantum supremacy was achieved by their quantum computer Sycamore 8. They showed that a task, which would take 10,000 years to compute on a supercomputer, only took 200 seconds on Sycamore. Moreover, just recently at the start of December 2020, researchers at the University of Science and Technology of China also published that they were able to demonstrate quantum supremacy using a photon-based quantum computer 9. The task, which could be solved by the quantum device in a few minutes, would otherwise be solved in 2.5 billion years by a classical supercomputer, according to the research group. These two demonstrations, by the research groups, provide a glimpse of the bright future of quantum simulation research.

In this thesis, we will explain some of the fundamentals and basics of quantum computing. We will show a simple example using Bernstein-Vazirani’s algorithm 10 using these fundamental concepts. We will then introduce four quantum mechanical systems, which will then be simulated on IBM’s , QASM ∗. These demonstrations include 6-qubit simulations of a free particle, an eigenstate in an infinite well, reflection and transmission through a step potential, and quantum tunneling. These simulations will also be run on one of IBM’s 5-qubit quantum computers, ibmq vigo, and compared to the results computed by the QASM simulator.

∗The QISKitcode is available here: https://github.com/Abou-el-ela/Schrodinger-Equation

6 2 Quantum Computation 2.1 Qubits In classical computing, the bit is the smallest unit of information, the value of which can be the binary digits 0 or 1. When a series of bits are put together, they can represent another binary number, which can be processed later to be another piece of information (e.g. the alphabet in ASCII). A quantum computer, on the other hand, has the quantum bit, or qubit is the fundamental unit of information. The qubit takes advantage of superposition, and can be expressed as a linear combination of a state of |0i and a state of |1i. We can describe this superposition similar to how we describe a 1/2 particle:

|ψi = α |0i + β |1i (1) The coefficients are complex numbers, whose absolute squares represent the measurement probabilities of each state,

2 P0 = |α| 2 (2) P1 = |β|

and are normalised, |α|2 +|β|2 = 1. This can be best represented by the Bloch Sphere, shown in Fig. 1.

Fig. 1: The state of a qubit can be represented in the image of a Bloch Sphere. This can be easily interpreted by  θ  iφ  θ  the more general form of the wavefunction: |ψi = cos 2 |0i + e sin 2 |1i, where θ is the polar angle that determines the probabilities of the measurement, and φ is the azimuthal angle known as the phase, which has no effect on the probabilities of the measurement. Figure courtesy of Nielsen. 1

The quantum computer gets more power when more qubits are added. As an example, suppose we have 2 qubits, |ψai and |ψbi; we can represent their superposition state as the tensor

7 product |ψai ⊗ |ψbi, where:

|ψai ⊗ |ψbi = (αa|0ia + βa|1ia) ⊗ (αb|0i + βb|1ib) (3)

= αaαb|0ia|0ib + αaβb|0ia|1ib + βaαb|1ia|0ib + βaβb|1ia|1ib

= γ1|00i + γ2|01i + γ3|10i + γ4|11i (4)

We can clearly see that from only 2 qubits, we were able to get 4 pieces of information. In fact, the pieces of information increase by an exponential factor 2N , where N is the number of qubits. 2 For classical bits, however, that number scales by N. This gives a great advantage for quantum computers to simulate quantum systems, since the also increases by an exponential factor 2N , where N, is the number of particles 1,2 As an example, if we 1 were to simulate 500 quantum particles with spin 2 , then the pieces of information, in this case coefficients, that will be required is 2500, which is more than the number of atoms in the universe 1. For a classical computer, that would be impossible to calculate. However, we expect that it would be, in principle, possible using a quantum computer with slightly more than 500 qubits, depending on the number of ancilla qubits (we will discuss more about the ancilla qubit in a later section).

2.2 Quantum Gates and Quantum Logic Gates are the basis of computational logic. In classical computing, gates are used to process and manipulate bits. The most basic of these classical gates include a NOT gate, which turns a |0i into a |1i, or vica versa, the OR gate, which returns a |1i if at least one of the input bits is |1i, and the AND gate, which returns |1i only if both of the input bits are |1i. In quantum computing, on the other hand, there are quantum gates. There is a specific criterion for a quan- tum gate that must be met, and it’s that it must be reversible; meaning that given an operation on a qubit, there must be an inverse. This reversibility is not seen in classical computing, e.g. there does not exist a reverse classical AND gate. Quantum gates can be represented in terms of unitary matrices, since they can be thought of as operators that operate on qubits. These unitary matrices, by definition, have the property UU † = 1, where U † is the complex conjugate transpose of U 11. The simplest example of such an operator is the quantum NOT gate, which is represented by Eq.(5).

 0 1  X = (5) 1 0

Operating the NOT gate on an initial state |ψii = |0i gives us the result in Eq.(6).

8 |ψf i = X |ψii

 0 1   1  = 1 0 0 (6)  0  = = |1i 1

Another basic and commonly used quantum gate is the Hadamard gate, Eq. (7).

1  1 1  H = √ (7) 2 1 −1

This gate is one of the gates that use the effects of quantum , as it sets up a superposition on a qubit. Suppose a qubit in the initial state as before, |ψii = |0i, is acted on by an H-Gate. The final state of the qubit, as shown in Eq. (8), will be a superposition state of equal probabilities between 0 and 1:

|ψf i = H |ψii

1  1 1   1  = √ 2 1 −1 0 (8) 1  1  1 1 = √ = √ |0i + √ |1i 2 1 2 2

We notice from Table 1 that there are multi-qubit gates, such as the CNOT, CCNOT, and CP gates. These gates are split into two parts, the control and the target. If we take the CNOT as an example, the target will change its state only if the control is 1. A good way to visualise it is by drawing all the possible states before the gate and after:

|00i −→ |00i |01i −→ |01i (9) |10i −→ |11i |11i −→ |10i

9 Quantum Gates

 1 1   0 1  H = √1 X = 2 1 −1 1 0

 1 0 0 0    1 0  0 1 0 0  Rφ = CRφ =   0 eiφ  0 0 1 0  0 0 0 eiφ

 1 0 0 0 0 0 0 0   0 1 0 0 0 0 0 0      1 0 0 0  0 0 1 0 0 0 0 0     0 1 0 0   0 0 0 1 0 0 0 0  CX =   CCX =    0 0 0 1   0 0 0 0 1 0 0 0    0 0 1 0  0 0 0 0 0 1 0 0     0 0 0 0 0 0 0 1  0 0 0 0 0 0 1 0

Table 1: List of commonly used quantum gates. Row 1: Hadamard Gate - NOT Gate. Row 2: Phase Gate - Controlled Phase Gate. Row 3: Controlled NOT Gate - Controlled Controlled NOT (Toffoli) Gate

Fig. 2: A quantum circuit schematic of the CNOT Gate. The control is represented by a dot, while the target is box with the ’+’

10 2.3 Bernstein-Vazirani Algorithm 2.3.1 The Algorithm The unitary and unique quantum properties of quantum gates and quantum computing can be best seen in a quantum circuit implementing Bernstein-Vazirani’s algorithm. Suppose there is a black box, which we will refer to as the Oracle, that holds an N-bit long number that we would like to know. This secret number acts like a key, and the black box will only accept the correctly guessed number. Let’s take the binary 1010 as an example. A classical computer would start counting up from 0000 to 1111, until it successfully guesses the correct key 1. This process can take up to 2N guesses before getting the number. Using quantum logic, Bernstein and Vazirani showed a quantum computer would reduce the process to one attempt 10, using only a series of Hadamard gates and CNOT gates. The implementation of the algorithm can be seen in Fig. 3.

Fig. 3: The quantum circuit of Bernstein-Vazirani’s Algorithm.

The horizontal lines in Fig. 3 correspond to the qubits, q0, q1, ... and the circuit is read from left to right. Vertically, we are using the convention where the quantum register, q3, corresponds to the highest order qubit and q0 to the lowest order qubit. We have an additional ancillary qubit, q4, which we use to assist us with the calculations, but is then discarded and not measured in the end. At the very bottom, there is the classical register, denoted by C and a double line. This register is the classical part of the quantum computer, and it is where it comes into contact with classical gates such as the measurement gate, as can be seen from the figure.

Quantum computers are initialised by default such that all the qubits are |0i. To start building the Bernstein-Vazirani circuit, we start by adding Hadamard gates to all the qubits. The Hadamard gates will transform the |0i state to a superposition of equal , which can be rewritten as |+i = √1 (|0i + |1i). When we do this on a series of qubits, the coupled 2 states can be expressed as,

11 H⊗n 1 X |00 ... 0i −→ √ |xi, (10) 2n x∈{0,1}n

where n is the number of qubits, and |xi is the computational basis. Let us imagine that the Z-gate and the CNOT gates do not exist for a moment. If we were to put another series of Hadamard gates immediately and apply a measurement, we would get back the initial state |00 ... 0i, Fig.4.

Fig. 4: A quantum circuit representation of the unitary property of the Hadamard gate.

From Fig.4, it can be difficult to see how the unitary property can be put into use. This is where the oracle becomes useful. The oracle can be thought of as a function, f, which performs the following operation, which can be also represented in circuit form in Fig.5:

f |xi → (−1)s·x|xi (11)

The s corresponds to a number, in binary representation, that the oracle holds, and s · x is the sum of the bitwise product, s · x = s0x0 ⊕ s1x1 ⊕ ... ⊕ sn−1xn−1. Meaning that f returns the value 1 when s · xmod2 = 1 and 0 when s · xmod2 = 0. As it turns out, the implementation of this oracle requires the use of an ancillary qubit. An ancillary qubit is an extra qubit that is used to hold information and to assist with the calculation, but is not measured at the end of the circuit and is discarded. In our example from Fig.3, we can see that the ancillary qubit is the bottom-most qubit, q4. It is initialised differently from the rest of the qubits as it has a Z-gate after the Hadamrd gate which initialises it in a |−i = √1 (|0i − |1i). We can think of it 2 as having a phase shift of π on its |1i. This qubit will then be the target to a series of CNOT gates. In our example, we take the s = 1010. This is implemented by having the controls of the CNOT on the qubits, whose values would represent 1, while leaving the 0’s to be empty. The target of the CNOT gates is the ancillary qubit. What these CNOTs do is that they apply a phase shift on the qubits that satisfy the CNOT control condition. Meaning that in Fig.3, the first CNOT will apply a phase shift of π on the states |xxx1xi, and the second CNOT on the |x1xxxi Notice that even though we won’t measure the ancillary qubit, I have added it when representing the previous state to highlight its importance in applying these phase shifts. This is what corresponds to the −1s·x factor; it determines which states will have a negative factor, and which won’t. This is a crucial step such that when we add the final series of Hadamard gates they will return |0i for the qubits that had not been applied a phase shift on, and |1i otherwise.

12 1 X H⊗n √ (−1)s·x|xi −→ |si (12) 2n x∈{0,1}n

Fig. 5: The oracle acting on an input |xi

2.3.2 Running on QASM and IBMq There are two methods to simulate a quantum circuit. The first method is using a quantum computer simulator. IBM’s QISKIT has multiple simulators in its library, namely the statevec- tor simulator and the Quantum Assembly Language simulator, or QASM. Both are simulators that do not use quantum computers, but are very useful when trying to check the accuracy of a circuit to easily debug it, before running it on the noisy and error-prone quantum computers. The difference between them is how they present the measurements. The statevector simulator assumes an ideal quantum device with no noise 12; the result of which is a perfect outcome of a proposed circuit with no errors. The QASM simulator, on the other hand, attempts to mimic a quantum computer by adding little noise to the result 12; however, that is not always the case, as we will see with the example we have at hand. QASM also operates by running the circuit multiple times, storing the number of times an outcome has occurs, which is similar to what an actual quantum computer does. The result can be then best seen by a plotting a histogram. We choose to use the QASM simulator in this thesis, as it is more accurately mimics a quantum computer than the statevector simulator. Running the circuit in Fig.3 with s = 1010 on the QASM simulator with 1024 shots, we get a perfect answer as shown in Fig.6a.

Simulating on a quantum computer is very different. Quantum computers are noisy ma- chines that are error-prone. By adding more gates, especially controlled gates, you increase the percentage of error of the final outcome. Hence, we expect that there would be discrepancies in the histogram, which is indeed the case as seen in Fig.6b. The quantum computer was able to guess 1010 correctly with an accuracy of 63%, and other outcomes being spread around due to noise error.

13 (a) QASM Simulator (b) ’ibmq vigo’ Quantum Computer

Fig. 6: Histogram produced by QASM and IBM’s quantum computer

14 3 Quantum Simulation

The aim of this thesis is to simulate single particle quantum systems using quantum computers. Simulating these systems can be split into two main parts. The first part is the wavefunction initialisation. The second part is creating and implementing a time-evolution algorithm that accurately evolves the wavefunction over time, and that bypasses the noncommutativity of the Hamiltonian operators. Once these two parts are resolved, we can tweak the values of the potential and kinetic energies of the system to simulate (i) the free particle, (ii) eigenstate of a particle in an infinite well, (iii) a particle reflecting and transmitting through a step potential, (iv) and quantum tunneling.

3.1 Initialisation To initialise the desired wavefunction, ψ(x), we need to discretise the domain, x, into grid points. That way, we can initialise the wavefunction over a series of N qubits. Since there are a finite amount of qubits, then we can say that the region of takes place between −d ≤ x ≤ d. 2d N That way, we can take equal intervals of ∆ = 2N , where 2 is the number of intervals. The wavefunction can then be discretised by:

2n−1 2n−1 X 1 X c (t)|ki = ψ (x , t) |ki, (13) k N k k=0 k=0 1  13 where xk ˙= − d + k + 2 ∆ , and |ki is the computational basis . Because the square of the coefficients of the computational bases represented probabilities, they must be normalised by: v u2n−1 u X 2 N ≡ t |ψ (xk, t)| (14) k=0

3.2 Time-Dependant Schr¨odingerEquation One of ’ postulates states that the time dependence of a quantum system can be represented by the time dependent Schr¨odingerequation, Eq.(15), ∂ H|ψ(t)i = i¯h |ψ(t)i, (15) ∂t

where H is the Hamiltonian of the system, and |ψ(t)i is the time-dependent wavefunction. By solving this differential equation, we get:

−iHt |ψ(t)i = e |ψiniti , (16)

where |ψiniti is the wavefunction evaluated at t = 0. Given that the Hamiltonian is the total energy of the system, we can rewrite it as H = K + V , where the terms are the potential and kinetic energy operators respectively. We notice, however, that V and K do not commute, meaning that eV +K 6= eV eK , making simulating the system not an easy task. Fortunately, we can use Trotter’s formula to resolve this issue and rewrite Eq.(16) to, 14,15

15 −i(K+V )t |ψ(t)i = e |ψiniti ,

t (17)  −iK∆t −iV ∆t O(∆t2) ∆t = e e e |ψiniti .

The formula in Eq.(17) is accurate within the truncation error of O(∆t2). This could be improved to higher orders, but it would require more quantum gates to simulate, which is not favourable with current quantum devices.

3.2.1 Quantum Fourier Transform † If we recall from , we can write K in terms of the momentum operator p2 as K = 2m . We initially start the in the x-representation, where the the operator p is not diagonal. We can then use a Quantum Fourier Transform, QFT, to pass from the position-representation to the momentum-representation, then its inverse to revert back to the position-representation. The momentum operator can be then rewritten in the form,

2 −iK∆t † −i p ∆t e = F e 2m F. (18)

To understand how we can implement this in a quantum circuit, we need understand the Discrete Fourier Transform (DFT) first, since the Quantum Fourier Transform is merely a quantum implementation of it. Suppose we have two sequences, X = {x0, x1, ..., xk, ..., xN−1} and Xe = {xe0, xe1, ..., xek, ..., xeN−1}, where DFT maps elements from X to their corresponding transformations in Xe in the form of 16:

N−1 X 2πi k·j x¯k = xj · e N (19) j=0

As shown by Nielsen 1, we can translate the DFT to the QFT by:

†The 6-qubit circuit for the QFT and its inverse can be found in Appendix A.

16 2n−1 1 X n |xi → e2πijk/2 |ki 2n/2 k=0

1 1 1 X X 2πix Pn k 2−l = ... e ( l=1 l ) |k . . . k i 2n/2 1 n k1=0 kn=0

1 1 n 1 X X O −l = ... e2πixkl2 |k i 2n/2 l k1=0 kn=0 l=1

n " 1 # 1 O X −l = e2πixkl2 |k i 2n/2 l l=1 kl=0

n 1 O h −l i = |0i + e2πix2 |1i , 2n/2 l=1

to finally arrive at,

1  2πi x   2πi x  QF TN |xi = √ |0i + e 2 |1i ⊗ |0i + e 22 |1i ⊗ ... N  2πi x   2πi x  ⊗ |0i + e 2n−1 |1i ⊗ |0i + e 2n |1i , (20)

where N = 2n.

This can be then implemented to a quantum circuit using a series of Hadamard gates and Controlled Phase gates, Fig.7. The QFT is made out of unitary gates, so it itself is unitary, i.e. taking its inverse should be possible by taking the mirror image of it and changing the signs of φN , Fig.8. As an example, let’s apply a two qubit system, where the Eq.(20) will be on the Right-Hand-Side (RHS) and the matrix operation by the gates in Fig.8 will be the Left-Hand- Side, and then compare both results. Starting with an initial state of x = 1, the RHS can be written as,

17 Quantum circuit implementation of the QFT, where φ = 2πi . Figure 1 Fig. 7: N 2N

1  2πi x   2πi x  QFT |xi = |0i + e 2 |1i ⊗ |0i + e 22 |1i 2/2 2 x=1

1    πi  = |0i − |1i ⊗ |0i + e 2 |1i 22/2

1  iπ iπ  RHS = |00i − |01i + e 2 |10i − e 2 |11i . 2

From the circuit, to get the rotation to operate on the first qubit, we need the second qubit iπ/2 to be in a state of |1i. Thus, we get that q1 → |0i + e |1i and q2 → |−i = |0i − |1i. By combining them with a tensor product we get,

1   LHS = |0i + eiπ/2 |1i ⊗ (|0i − |1i) 2 1   = |00i − |01i + eiπ/2 |10i − eiπ/2 |11i . 2

Comparing the quantum circuit (LHS) and the results of Eq.(20), we can see that the quan- tum circuit can act as an implementation of the Quantum Fourier Transform.

18 Fig. 8: Quantum Fourier Transform followed by its inverse. Notice how φ is negative in the inverse QFT. Figure courtesy of Nielsen and Chang 1

3.2.2 Momentum Operator

2 ‡ To derive the momentum operator, e−ik ∆t, we go back to how binary numbers are repre- sented. An n-bit number can be expressed by their binary representation as,

n−1 k = kn−12 + ··· + k12 + k0, (21)

1  where k0, k1, ..., kn−1 ∈ {0, 1}. If we then combine Eq.(21) with xk ˙= − d + k + 2 ∆, which we introduced in a previous section, then we can derive: 13,17

  r n 1 φ X kˆ = − 1 + 2n−jZˆ (22) 22n−3 ∆t  j j=1

 2  n    iφ X exp −ikˆ2∆t = exp  1 + 2n−jZˆ  (23) 22n−3  j  j=1

th Zˆj corresponds to a phase gate, as defined in Table.1, at the j qubit. The phase shift, φ, is interpreted in Eq.(23) as the time step, which will be user-defined. As a condition by Trotter’s formula, this φ needs to be small; in most of our simulations we took φ = 0.1. We can easily see that from Eq.(23) there will be terms with a single qubit operations, and others with commuting qubit operations in the form Zi ⊗ Zj. To implement a commuting qubit operation, we need to add an ancillary qubit which is the target of two CNOT gates, from each qubit i, j, and a phase gate, Fig.9.

As an example, if we consider a 3-qubit system with φ = π, then we can expand Eq.(23), and use the rules presented by Nielsen in Fig.9 to build the quantum circuit, which is shown in Fig.10

‡The momentum operator for a 6-qubit quantum circuit can be found in Appendix A.

19 1 Fig. 9: Quantum circuit simulating the Hamiltonian H = Z1 ⊗ Z2 ⊗ Z3 as shown by Nielsen

Fig. 10: The momentum operator for a 3-qubit system.

20 3.2.3 Algorithm Overview

Fig. 11: Quantum circuit representation of the time evolution operator for a single time step.

Combining all that was developed in the previous sections, we arrive at the decomposed time operator,

 2  i p i −1 − h¯ 2m ∆t − V (x)∆t |ψ(t)i = F e F e h¯ |ψiniti , (24)

1 where we takeh ¯ = 0 and m = 2 . The overall circuit for an n-qubit system is represented by Fig.11. We first initialise the wavefunction onto the qubits q1, q2, ..., qn−1. We note that unlike 1 Nielsen’s convention, we denote the top qubit, q0, to be the ancillary qubit. We then define the potential by putting a series of phase gates onto the appropriate qubits to produce the desired potential. We then apply the Quantum Fourier Transform as defined in Eq.(20), followed by the momentum operator defined by Eq.(23). Finally we revert back to the position representation by an inverse quantum Fourier transform, before we do the measurement.

21 4 Results 4.1 Infinite Square Well If we recall from quantum mechanics, the infinite square well problem requires us to solve the Schr¨odingerequation,

 ¯h2 d2  − + V (x) ϕ (x) = Eϕ (x), (25) 2m dx2 E E where,   ∞, x < 0 V (x) = 0, 0 < x < L (26)  ∞, x > L.

Solving Eq.(25) with the boundary conditions of Eq.(26), we get that the solution is the normalised eigenstate ,

r 2 nπx ϕ(x) = sin( ), n = 1, 2, 3, ... (27) L L

However, we will need to modify our initialisation condition to accompany the periodic boundary of the quantum simulation region. What we do is to extend the computational basis to be 0 ≤ x ≤ 2L, such that we define the wavefunction in the first half of the computational space. We then add a phase gate, with V = 1000 at the highest order qubit, to define a step potential throughout the second half, see Fig.12. This mimics an infinite well at the first half of the simulation region, and ensures that there will be no tunneling. Qiskit was used to implement all the following simulations, and the code can be found on Github§. We used the built-in initialisation function by Qiskit to initialise the wavefunction on the qubits. It is expected that no matter how many iterations, the eigenstate would still be in the same position. In Fig.13, we see the initial state of the system on the left-hand side, and the state of the system after 15 iterations. A time- step of ∆t = 0.1 was defined, and QASM was used to simulate the quantum system.

As expected, the eigenstate represents a stationary half sine-wave, as was initialised. There are, however, some fluctuations in the probabilities, but that is because of how QASM operates its simulations by adding some noise to the simulation.

§The code is available here: https://github.com/Abou-el-ela/Schrodinger-Equation

22 Fig. 12: A visualisation of the 6-qubit initialisation of the half sine with the potential at half of the simulation space

(a) Initial State (b) State after 15 iterations

Fig. 13: Results from QASM: Left-hand side showing the initial state, right-hand side showing state after 15 iterations

23 4.2 Free Particle The free particle simulation is probably one of the easier quantum system to simulate, since it has no potentials, i.e. V = 0. We start of by initialising a Gaussian wave packet in the position-space of the form,

Fig. 14: The Gaussian curve that will be initialised onto the qubits, with µ = 0 and σ = 0.4

2 1 − 1 x−µ |ψ(x)i = √ e 2 ( σ ) , (28) σ 2π

where we took µ = 0 and σ = 0.4, in the interval −2 ≤ x ≤ 2. We then apply the time evolution operator with no potential, since it is a free particle.

(a) Initial State (b) 8th Iteration (c) 12th Iteration

Fig. 15: Three different states of the free particle as measured by QASM with a ∆t = 0.3

In the simulation, we set ∆t = 0.3 and ran the simulation on the QASM simulator over 12 iterations. We can see from the results in Fig.15 that the initial Gaussian, Fig.15a, acts as expected and diffuses through every iteration, as we can see from Fig.15b and Fig.15c.

24 4.3 Particle in a Step Potential The previous simulations we have been dealing with stationary particles. But when simulating for effects, like tunneling, reflection, and transmission, it is better to simulate a moving wave- function. We can add some momentum, p, by multiplying Eq.(28) with a complex factor, eipx. This modifies Eq.(28) to be,

2 1 − 1 x−µ ipx |ψ(x)i = √ e 2 ( σ ) e . (29) σ 2π

As in the previous example, we set µ = 0 and σ = 0.4, but change the interval such that −1.5 ≤ x ≤ 3. This ensures that the wave packet is initialised away from the potential barrier. We set the momentum to be p = 300. Setting up the potential barrier is the same as setting up the one in Section (4.1), where we add a phase gate at the highest order qubit. We ran the simulation on QASM with three different potentials, V = 2, V = 3, V = 5.

(a) Initial State (b) 10th Iteration (c) 13th Iteration

Fig. 16: Three different states of the particle in a step potential of V = 2 simulation as measured by QASM with ∆t = 0.1

(a) Initial State (b) 10th Iteration (c) 13th Iteration

Fig. 17: Three different states of the particle in a step potential of V = 3 simulation as measured by QASM with ∆t = 0.1

25 (a) Initial State (b) 10th Iteration (c) 13th Iteration

Fig. 18: Three different states of the particle in a step potential of V = 5 simulation as measured by QASM with ∆t = 0.1

It is expected that the higher the potential, the less the transmission; this is what was ob- served as illustrated in Fig.16 - 18. When the potential was set to be V = 2, the transmission to reflection ratio is almost one-to-one. Naturally, when the potential was increased to V = 3, the transmission was decreased immensely, while the reflection increased. Finally when the potential was increased to V = 5, we observed a total reflection, with zero transmission of the wave packet through the step potential.

26 4.4 Quantum Tunneling

Suppose a particle with an energy, E, wishes to pass through a potential barrier, V0, where E < V0 (See Fig.19). Classically, the particle will never pass through the barrier, and the only way to get through is for it to obtain a greater energy, such that it can ”go over” the potential barrier.

Fig. 19: A potential barrier with the incident particle energy below the potential barrier height 2

A quantum mechanical particle, however, acts differently. The quantum particle can pen- etrate through the classically forbidden region, and come out of the other side, in a process known as quantum tunneling. 2,11 Unlike in the step potential example in the previous section, the within the potential barrier exponentially decreases, giving us the characteristic shape of quantum tunneling (see Fig.20).

To simulate this on a quantum computer, we use the same quantum algorithm as before, with the exception of the potential. To recreate the potential in Fig.20, we propose a circuit, which was motivated by Valay J. Kain’s preprint, that is composed of Toffoli gates, and a Controlled- Phase gate. 18 The circuit would act as a filter for the quantum registers, whose 2nd, 3rd, and 4th highest order qubits are required to be 1’s, i.e |x111xxi (See Fig.35 in the Appendix). A similar approach was taken with two CNOT-gates and a phase gate to produce a wider barrier that goes throughout the bases |x11xxxi (See Fig.36 in Appendix). This ensures that a potential, V, would only be applied to the quantum registers of this form. The output of the initialised wavefunction with the potential barrier can be seen in Fig.21 and Fig.22c The results of the simulation at the 10th and 12th iterations can be seen in Fig.21. By the 10th iteration, we are able to see the characteristic exponential decay within the barrier, which is then enhanced and can be seen more clearly in the 12th iteration.

27 Fig. 20: An incident sinusoidal wavefunciton quantum tunneling through a barrier. The wavefunciton expo- nentially decays within the potential barrier. 2

28 4.4.1 Barrier Through the |x111xxi Bases

(a) The wavefunction, Eq.(29), initialised with p = 300, V = 1.75, and ∆t = 0.1. The x-interval is between −0.5 ≤ x ≤ 4.

(b) 10th Iteration

(c) 12th Iteration

Fig. 21: Three different states of the quantum particle tunneling through a potential barrier of height V = 1.75.

29 4.4.2 Barrier Through the |x11xxxi Bases

(a) The wavefunction, Eq.(29), initialised with p = 300, V = 1.75, and ∆t = 0.1. The x-interval is between −0.5 ≤ x ≤ 4.

(b) 10th Iteration

(c) 12th Iteration

Fig. 22: Three different states of the quantum particle tunneling through a potential barrier of height V = 1.75.

30 5 Running 4-qubit Simulations on ibm vigo

Using 4 qubits, we were able to decrease the amount of gates, such that the IBM quantum computers would allow the simulations. The results, however, were unflattering. This is mainly due to the very noisy and error-prone nature of quantum computers. In the coming subsections, we will compare the results produced by a 4-qubit simulation on QASM, and those produced by IBM’s 5-qubit quantum computer, ibmq vigo. We keep the initial conditions the same as the 6-qubit simulations with exception of the simulation distance, d. It was important for us to 2d keep ∆ = 2N constant, such that the results would resemble that of the 6-qubit simulations’.

5.1 Infinite Square Well 5.1.1 QASM

(a) Initial State (b) 2nd Iteration

Fig. 23: Two states of the eigenstate in an infinite well simulation as measured by QASM with ∆t = 0.1

5.1.2 ibmq vigo

(a) Initial State (b) 2nd Iteration

Fig. 24: Two states of the eigenstate in an infinite well simulation as measured by ibmq vigo with ∆t = 0.1

31 5.2 Free Particle 5.2.1 QASM

(a) Initial State (b) 3rd Iteration (c) 5th Iteration

Fig. 25: Three states of the free particle simulation as measured by QASM with ∆t = 0.1

5.2.2 ibmq vigo

(a) Initial State (b) 3rd Iteration (c) 5th Iteration

Fig. 26: Three states of the free particle simulation as measured by ibmq vigo with ∆t = 0.1

32 5.3 Particle in a Step Potential 5.3.1 QASM

(a) Initial State (b) 5th Iteration (c) 7th Iteration

Fig. 27: Three states of the step potential simulation at V = 2 as measured by the QASM simulator with ∆t = 0.1

5.3.2 ibmq vigo

(a) Initial State (b) 2nd Iteration (c) 3rd Iteration

Fig. 28: Three states of the step potential simulation with V = 2 as measured by ibmq vigo with ∆t = 0.1

33 5.4 Quantum Tunneling 5.4.1 QASM

(a) Initial State (b) 4th Iteration (c) 5th Iteration

Fig. 29: Three states of the quantum tunneling simulation with V = 1.75 as measured by the QASM simulator with ∆t = 0.1

5.4.2 ibmq vigo

(a) Initial State (b) 2nd Iteration (c) 3rd Iteration

Fig. 30: Three states of the quantum tunneling simulation with V = 1.75 as measured by ibmq vigo with ∆t = 0.1

34 6 Discussion & Conclusion

The 3 and 6-qubit quantum simulations on QASM show us that it is indeed theoretically possible to simulate quantum systems using quantum computers. However, when running on the actual quantum computer, we can barely pass through the first iteration without the errors start to take over, and produce unrealistic results. These errors prevent us from extracting useful infor- mation, and from running realistic and accurate simulations. They arise from multiple factors: an increased number of controlled gates, the noisy nature of quantum computers, imperfect hardware, and decoherence of qubits. 13,19 Additionally, the number of quantum gates increases as the number of qubits increases, which is not ideal, since IBM’s maximum allowed number of gates is 75. Hence, we needed to decrease the number of qubits to four, such that we can perform the simulations on their quantum computers. This meant that the resolution for the simulation decreased, as the number of grid points went from 64 points to just 16. This lack of resolution adds more to the inaccuracy of the simulations. We expect with the advancement of quantum computer technology, there will be enough noise reduction to allow accurate simula- tions of quantum systems on higher number of qubits.

Quantum computation is still a subject in its infancy, and it is expected that the technology is still not perfect. Nevertheless, studying it is of great importance due to its useful applications. We suggest multiple topics that can take our studies in this thesis further: (i) simulation of eigenstates of an infinite well at higher modes, (ii) numerically calculating the transmission and reflection coefficients of the step potential and quantum tunneling simulations, (iii) and numer- ically calculating the relationship between the barrier width and transmission in the quantum tunneling simulation.

35 References

[1] Michael Chuang, Isaac; Nielsen. Quantum Computation and , by M.A. Nielsen and I.L. Chuang, volume 52. 2011. [2] David McIntyre. Quantum Mechanics: A Paradigm Approach. Pearson, 1 edition, 7 2012. [3] Richard P. Feynman. Simulating physics with computers. International Journal of Theo- retical Physics, 21(6-7):467–488, 1982.

[4] Peter W. Shor. Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer. SIAM Journal on Computing, 26(5):1484–1509, Oct 1997. [5] Lov K. Grover. A fast quantum mechanical algorithm for database search. In Proceedings of the Twenty-Eighth Annual ACM Symposium on Theory of Computing, STOC ’96, page 212–219, New York, NY, USA, 1996. Association for Computing Machinery. [6] David Deutsch and Richard Jozsa. Rapid solution of problems by quantum computation. Proceedings of the Royal Society of London. Series A: Mathematical and Physical Sciences, 439(1907):553–558, 1992. [7] John Preskill. Quantum computing in the NISQ era and beyond. Quantum, 2(July):1–20, 2018. [8] Frank Arute and et al. Quantum supremacy using a programmable superconducting pro- cessor. Nature, 574(7779):505–510, 2019. [9] Han-Sen Zhong and et al. Quantum computational advantage using photons. Science, 2020.

[10] Ethan Bernstein and Umesh Vazirani. Quantum complexity theory. SIAM Journal on Computing, 26(5):1411–1473, 1997. [11] David J. Griffiths. Introduction to Quantum Mechanics (2nd Edition). Pearson Prentice Hall, 2nd edition, April 2004.

[12] Daniel Koch, Laura Wessing, and Paul M. Alsing. Introduction to coding quantum algo- rithms: A tutorial series using qiskit. arXiv, pages 1–129, 2019. [13] Giuliano Benenti and Giuliano Strini. Quantum simulation of the single-particle Schr¨odingerequation. American Journal of Physics, 76(7):657–662, 2008. [14] Christof Zalka. Simulating quantum systems on a quantum computer. Royal Society Pub- lishing, 454(1969):313–322, 1998. [15] Andrew T. Sornborger. Quantum simulation of tunneling in small systems. Nature, 2(5):1– 4, 2012. [16] Daniel Koch, Saahil Patel, Laura Wessing, and Paul M. Alsing. Fundamentals In Quantum Algorithms: A Tutorial Series Using Qiskit Continued. arXiv, 2020. [17] Afonso Rodrigues. Afonso Rodrigues Validation of quantum simulations Afonso Rodrigues Validation of quantum simulations. PhD thesis, Universidade do Minho, 2018.

36 [18] Valay Kumar Jain, Bikash K Behera, Prasanta K Panigrahi, and Valay K Jain. Quan- tum Simulation of Discretized Harmonic Oscillator on IBM Quantum Computer Quantum. ResearchGate, (July), 2019. [19] Abraham Asfaw and et al. Learn quantum computation using qiskit, 2020.

37 Appendix Quantum Fourier Transform

Fig. 31: A 6-qubit implementation of the Quantum Fourier Transform. Note that the q0 is the ancillary qubit.

Inverse Quantum Fourier Transform

Fig. 32: A 6-qubit implementation of the Inverse Quantum Fourier Transform. Note that the q0 is the ancillary qubit.

38 Momentum Operator

Fig. 33: A 6-qubit implementation of the momentum operator with φ = π. Note that the q0 is the ancillary qubit

39 Potentials

Fig. 34: The potential used for the 6-qubit simulation, to apply a potential V on the highest order qubit.

Fig. 35: A filter for the states |x111xxi. The Toffoli gate’s controls are two of the 2nd, 3rd, or 4th highest order qubits, and its target is the ancillary qubit. The controlled phase gate’s control is the ancillary qubit, while the target is the remaining high order qubit from the stated three.

40 Fig. 36: A filter for the states |x11xxxi. The CNOT gates’ control is on the 3rd highest order qubit, and its target is the ancillary qubit. The controlled phase gate’s control is the ancillary qubit, while the target is the 5th highest order qubit.

41