0% found this document useful (0 votes)
48 views50 pages

Quantum Simulation of Schrödingers Equation

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views50 pages

Quantum Simulation of Schrödingers Equation

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

American University in Cairo

AUC Knowledge Fountain

Capstone and Graduation Projects Student Research

3-11-2021

Quantum Simulation of Schrödinger's Equation


Mohamed Eltohfa
[email protected]

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

Part of the Numerical Analysis and Scientific Computing Commons, Quantum Physics Commons, and
the Theory and Algorithms Commons

Recommended Citation
Eltohfa, Mohamed, "Quantum Simulation of Schrödinger's Equation" (2021). Capstone and Graduation
Projects. 23.
https://fount.aucegypt.edu/capstone/23

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
Schrödinger’s Equation

Mohamed Eltohfa

Bachelor’s Thesis

Department of Physics
The American University in Cairo

Supervised by Dr. Tarek Elsayed

Egypt
January 2021
Abstract

Quantum computing is one of the promising active areas in physics research. This is
because of the potential of quantum algorithms to outperform their classical counter-
parts. Grover’s search algorithm has a quadratic speed-up compared to the classical
linear search. The quantum simulation of Schrödinger’s equation has an exponential
memory save-up compared to the classical simulation. In this thesis, the ideas and
tools of quantum computing are reviewed. Grover’s algorithm is studied and simu-
lated as an example. Using the Qiskit quantum computing library, a code to simulate
Schrödinger’s equation for a particle in one dimension is developed, simulated locally,
and run on an actual IBM quantum computer. Several initial states are evolved in
zero, harmonic, and linear potential fields. The results obtained are compared with
similar results found in the literature.

1
Acknowledgement

I would like to express my special thanks of gratitude to my supervisor Dr. Tarek


Elsayed for his guidance, support, and unique insight. I would also like to thank my
colleague Mohamed Abouelela for our mutual work and discussions to understand
and implement the circuits.

2
Contents

1 Introduction 5

2 Quantum Computation 7
2.1 The qubit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 System of qubits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3 Quantum gates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.4 Measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.5 Multiple qubit gates . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3 Grover Search Algorithm 12


3.1 The algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2 Circuit simulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.2.1 2-qubit circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.2.2 3-qubit circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.2.3 4-qubit circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.3 Comparing with literature . . . . . . . . . . . . . . . . . . . . . . . . 20

4 Quantum Simulation of Schrödinger’s Equation 22


4.1 Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.2 Potential energy term . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.3 Kinetic energy term . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.4 Quantum Fourier transform . . . . . . . . . . . . . . . . . . . . . . . 24
4.5 Inverse quantum Fourier transform . . . . . . . . . . . . . . . . . . . 25
4.6 Diagonal phase matrix . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.7 The potential term . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.8 The time evolution circuit . . . . . . . . . . . . . . . . . . . . . . . . 28

5 Simulation Results 29
5.1 Free particle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
5.1.1 Dispersing Gaussian . . . . . . . . . . . . . . . . . . . . . . . 29
5.1.2 Moving Gaussian . . . . . . . . . . . . . . . . . . . . . . . . . 31
5.1.3 Stationary sinusoidal . . . . . . . . . . . . . . . . . . . . . . . 33
5.2 Harmonic potential . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.2.1 Coherent state . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.3 Linear potential . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

3
5.3.1 Accelerating particle . . . . . . . . . . . . . . . . . . . . . . . 41
5.4 Simulation on IBM computer . . . . . . . . . . . . . . . . . . . . . . 42

6 Recommendation for Future Research 46

7 Conclusion 47

Bibliography 48

4
Chapter 1

Introduction

Computer scientists look for better algorithms that can solve certain problems in
less time. For example, sorting an array is a common problem which has several
algorithms, some more efficient than the others. Bubble sort algorithm sorts an array
in almost as many steps as the square of the array size. The time complexity of
an algorithm is the number of steps (comparisons in the case of sorting algorithms)
in an algorithm as a function of the input size n. So bubble sort is said to have a
time complexity of O pn2 q, where n is the length of the list. Other algorithms for
sorting such as the heap sort has time complexity of O pn log nq. Thus, heap sort is
apparently better than bubble sort since it uses less steps and hence less time to solve
the same problem. Sometimes scientists cannot find efficient algorithms for solving
certain problems on classical computers.
Quantum computing is a new paradigm of problem solving that can provide al-
gorithms that are more time efficient than classical algorithms. Classical Computers
have classical memory bits that have two defined states, say 1 and 0. Algorithms
that run on a classical computer are referred to as classical algorithms. Quantum
computation exploits the nature of quantum properties of physical systems. A quan-
tum memory bit is called a qubit and it exhibits different characteristics from the
classical bit. One phenomenon is that it can be in the 0 state, the 1 state, or in a
combination of the two states. The combination, or the superposition, of the two
states is a new concept in quantum computing that does not have a classical analog.
Another phenomenon is the entanglement of two qubits. Two qubits can be set to be
in opposite states, a form of non-local correlation. On the other hand, Classical bits
are always independent of one another. Quantum algorithms exploit these features
which proves useful in creating algorithms that can solve problems more quickly.
For example, linear search of a list of length n?requires O pnq comparisons on a
classical computer, while it can be solved using O p nq steps on a quantum computer
[1]. The later method is called the Grover’s search algorithm. Another example where
quantum algorithms outperform classical algorithms in performance is the simulation
of quantum mechanical systems. A quantum mechanical (QM) system is inherently
complex and has many parameters. Richard Feynman pointed out that a QM system
of n particles cannot be simulated with O pnq classical registers[2]. However, a QM
computer can do this job because the qubits behave in the same manner and have

5
similar complexity to quantum particles.
The simulation of quantum mechanics is so important because our world, as far
as we know it, behaves according to QM rules. QM allows us to study the properties
of materials and enables us to design materials with desired properties. The study
of quantum computation allows us to explore efficient algorithms that can run in
reasonable amounts of time and give us astonishing results about the quantum world.
In this thesis, the components of quantum computation are explained. Secondly,
Grover’s algorithm and quantum simulation are studied in details. Thirdly, a general
size Grover’s search is developed, simulated locally on a classical computer, and run
a real quantum computer. Fourthly, a general size algorithm for simulating a free
particle, a particle in a harmonic potential, or a particle in a linear potential 1 is
introduced, simulated locally, and the results are analyzed.

1
This thesis was done in parallel with the work of Mohamed Abouelela as part of our graduation
project. In his thesis [3], Abouelela simulated the evolution of some initial quantum states in other
types of potentials that demonstrate quantum effects such as quantum tunneling.

6
Chapter 2

Quantum Computation

There are several ways to design a real quantum computer, but the fundamental
components of different hardware implementations can be represented abstractly in
a unified manner.
The state of a quantum computer is always represented by a vector living in a
complex vector space, which is referred to as the Hilbert space. A quantum algorithm
is a transformation that acts on Hilbert space. I.e. it is a function from the space
to itself. In most of the cases, the transformation is reversible. I.e., if we know the
output state we can tell the input state. In classical computers, the state is saved in
a classical register, a finite sequence of one-bit elements. Each bit can store one of
two states, called 0 and 1. Thus a n-register, which has n bits, can store one of 2n
states.

2.1 The qubit


In Quantum computers, an analog for the classical bit is called a qubit, short for
’quantum bit’. A qubit can store a state which is a vector in a two dimensional
Hilbert space. A vector space has a basis, which we can use to write any arbitrary
vector uniquely. The basis can be chosen to be orthonormal. This means each vector
in the basis has magnitude of 1 and is orthogonal to all other vectors in the basis.
If we denote the vectors of an orthonormal basis with |0y, and |1y, then an arbitrary
vector |φy could be written as

|φy “ α |0y ` β |1y (2.1)


ˆ ˙
1
Here α and β P C, where |α|2 ` |β|2 “ 1. We can represent the states |0y by ,
ˆ ˙ ˆ ˙ 0
0 α
|1y by , so the general state |φy is represented by . This means that we
1 β
can deal with the quantum state as a column vector with two complex entries and a
magnitude of 1.
The act of measuring a qubit in this basis is a probabilistic transformation of the
qubit state to one of the basis vectors with probabilities corresponding to the square of

7
the modulus of the coefficients in the expansion 2.1. The measurement requirement,
therefore, is a justification of the unit-length condition. The act of measurement
transforms |φy into |0y with probability |α|2 or |1y with probability |β|2 .

2.2 System of qubits


A system of n qubits will have a corresponding Hilbert space of dimension N “ 2n .
The basis can be written as or |0y , |1y , |2y , . . . , |N ´ 1y, which can be represented in
binary representation for n “ 3 as |000y , |001y , |010y , . . . , |111y. This basis is referred
to as the computational basis.
In general, any linear combination of the basis is a valid state. A multiple qubit
system can be thought of as n instants of 1-qubit systems brought together. There
are two cases. Either the qubits are independent of each other or not. If the qubits
are all independent, then the state of the big system can be written as a tensor
product of the states of the 1-qubit systems. This state is referred to as a separable
state If the qubits are numbered from 0 to n ´ 1 and the ith qubit is represented by
|φi y “ αi |0y ` βi |1y, then the overall state of the big system |ψy is represented by

ÿ
|ψy “ |φ1 φ2 . . . φn y “ |φ1 y |φ2 y . . . |φn y “ γ0 . . . γn´1 |bn´1 . . . b0 y , (2.2)
b0 ,...,bn´1 Pt0,1u

where γi “ αi if bi “ 0 or γi “ βi if bi “ 1.
The overall separable state is determined by 2n variables with each the it h qubit
contributing two variable (degrees of freedom) αi and βi . If the qubits state are
correlated, the qubits are said to be entangled. In that case, the overall state cannot
be written as a product state of the individual qubit states. In general, N “ 2n
variables are required to describe an entangled state.

2.3 Quantum gates


Quantum gates act on qubits just like classical gates act on bits. Single qubit gates
act on one qubit to alter its state. A single qubit gate is just an operator multiplying
the input qubit state to produce an output qubit state. In the computational basis,
operators are represented by matrices. These matrices are unitary and hence are
invertible. In that sense, all quantum gates have inverse quantum gates that undo
their effects. This is in contrast to classical gates which are not necessarily invertible.
One example of a single qubit gate is the NOT gate that alters the state |0y to
|1y and vice versa. It has therefore a matrix form which is
„ 
0 1
X“ . (2.3)
1 0
The NOT gate symbol in qiskit, the quantum computation coding library, is shown
in figure 2.1.

8
Figure 2.1 NOT Gate

We notice that this matrix is also Hermetian. I.e., the matrix is equal to its
complex conjugate or X “ X : . But a unitary matrix has X ´1 “ X : which results in
X “ X ´1 . Hence to undo a NOT operation, we use another NOT operation.
Another gate is the Hadamard gate (H-gate). This gate takes the pure com-
putational basis states and produces superposition states. It sends |0y to |`y “
?1 p|0y ` |1yq and |1y to |´y “ ?1 p|0y ´ |1yq . Thus, it has the matrix
2 2
„ 
1 1 1
H“? (2.4)
2 1 ´1
The H-gate has the symbol shown in figure 2.2.

Figure 2.2 Hadamard Gate

2.4 Measurement
A qubit initialized in the |1y state when measured will give 100% probability of the
|1y state. On the other hand, a qubit that has the initial state |`y “ ?12 p|0y ` |1yq
will give either state with probability as shown in figure 2.3

Figure 2.3 probabilities of measuring superposition state

In qiskit, a measurement gate is represented by the meter symbol connected to a


classical wire as shown in figure. 2.4

9
Figure 2.4 The measurement gate

2.5 Multiple qubit gates


A gate can act on two qubits at once. For example the CNOT gate has the effect of
reversing the state of the controlled qubit (input B) if and only if the control qubit
(input A) is in the |1y state. It has the effect shown in figure 2.5

Figure 2.5 The CNOT gate and its logic

A list of other gates used in this thesis is shown in figure 2.6.

10
Figure 2.6 The list of common gates used in this thesis with their symbols and matrix
forms [2]

11
Chapter 3

Grover Search Algorithm

Grover Search Algorithm is one of the famous quantum algorithms that outperform
their classical counterparts. In the usual linear search algorithm, we require OpN q
comparisons to find an element in an array of length ? N. Grover’s algorithm achieves
a quadratic speed up; i.e., it has a complexity of O( N ).It is believed that this com-
plexity is optimal [1]. This speed up is inherently due to the parallel computational
nature of quantum operators that can affect all of the coefficients in the state ex-
pansion at once. In this section, Grover’s algorithm is explained in detail along with
implementations on a local simulator and an IBM computer.

3.1 The algorithm


The input to the algorithm is an array where some elements are marked. These
elements are the elements we search for. For example, in the given figure we have an
array of length 8, where the element in index ω “ 4 is marked (indices start at 0).

Figure 3.1 Array of length 8 with marked element at index 4

The goal of the algorithm is to return the index of the marked element which is
4. We encode such array on a 3 qubit system where the basis is of size 8. We encode
the array elements using the computational basis vectors. E.g., the vector |000y
corresponds to the element in index 0, and the vector |111y corresponds the the last
element. In the figure, the marked element is associated with the vector |100y. The
element is marked using a special operator called the oracle operator. When the oracle
operator acts on the overall system state, it treats the marked element differently from
all other elements. For example, the phase oracle reflects the coefficient associated
with the marked element and leaves the other coefficients unchanged according to the
formula

12
"
|xy if x ‰ ω
Uω |xy “ (3.1)
´|xy if x “ ω.
We utilize the oracle operator along with Grover’s operator to amplify the ampli-
tude of the marked element and hence diminish the amplitude of the other elements.
Thereby, when we do a measurement, there is a higher probability of collapsing to
the basis vector associated with the marked element.
There are three steps in the algorithm. In step 1, we initialize the state using
H-gates into a uniform superposition of all basis vectors, according to the following
equation.
N ´1
1 ÿ
|sy “ ? |xy.
N x“0
The uniform superposition can be visualized as in figure 3.2a. If we make a
measurement at that point all indices are equally likely to be returned. We can also
visualize that state in another meaningful geometric way. Consider the marked vector
1D
|ωy and the uniform superposition of all other vectors s . These two vectors are
orthogonal and comprise a basis for a 2-dimensional space. This is the plane where
our system state lives in in all the steps of the algorithm. The uniform superposition
1D
is represented by a vector more aligned with s than with |ωy as shown in figure
3.2b.

(a) 2D plane of the system vector (b) All amplitudes are equal

Figure 3.2 The initial state in uniform superposition of all the basis vectors [4]

In step 2, we use the oracle to reflect the amplitude of the marked element as shown
in figure 3.3. We notice that the average amplitude drops because one coefficient is
1D
now negative. This operation is interpreted also as a reflection around the s axis.

13
1D
Figure 3.3 Oracle reflection around s [4]

The third step is to reflect the new system vector around the initial system vector
using the Grover reflection according to the equation Us “ 2|syxs| ´ 1. As depicted
in figure 3.4 , we see that the system vector becomes more aligned with the marked
vector. Thus, the oracle operator with Grover operator when applied consecutively
has the desired effect of amplifying the marked element amplitude. We can repeat
this process until
? the system state is nearly aligned with the marked axis. It can be
shown that Op N q steps of such process are sufficient for nearly perfect aligning [1].

14
Figure 3.4 Grover operator reflection around |sy[4]

If we are
alooking for more than one element (M marked elements), it can be shown
that only pN {M q Grover steps are needed [4].

3.2 Circuit simulations


In this section, several circuit sizes are studied. 2-qubit, 3-qubit, and 4-qubit circuits
are built and simulated on both the Qasm Simulator (a local statistical simulator)
and 5-qubit IBM computers (ibmq santiago and ibmq valencia).

3.2.1 2-qubit circuit


We search for the |11y state among the 4 vectors in the basis of a 2-qubit system.
The circuit starts with initialization using 2 H-gates applied to both qubits. Then a
phase oracle marking the |11y state is applied. The oracle here is just a controlled Z
gate [4]. The Grover operator (called diffuser) is then applied. In this case only one
operation of the oracle and the diffuser is needed. The circuit is shown below.

15
Figure 3.5 Grover circuit on 2 qubits starting with initialization then the oracle re-
flection then the diffuser[4]

Here are the results when simulated locally and on an actual IBM computer. We
see that local simulator is 100% accurate while the IBM computer is less than ideal
but the results are pretty good. The small error is due to the quantum noise and the
imperfections in the gates. The hardware gates are not 100% accurate.

(a) Local Qasm simulator (b) ibmq santiago quantum computer

Figure 3.6 2-qubit Grover search on local simulator vs quantum computer

3.2.2 3-qubit circuit


We are searching for |101y and |100y here. We need to apply the oracle and the grover
operator one time, just like in the 2 qubit circuit. The sequence of gates realizing
the oracle operator in that case, along with the Grover operator, is derived in [4] and
shown in figure 3.7 in both a block level and a gate level. First, The U2 gates perform
the initialization in the uniform superposition state. Second, the CZ gates perform
the oracle reflection.Third, the H gates perform a change of basis which transforms
|sy to |000y. Fourth, the X gates followed by the Toffoli gate followed by X gates
perform the reflection around |000y. Fifth, the H gates transform the |000y back to
|sy, so effectively the final reflection is around |sy. Finally, the qubits are measured

16
and the results are recorded in the classical register.

Figure 3.7 3-qubit Grover circuit searching for |101y and |100y in both a block level
and a gate level

The results are shown in the figure below. The local Qasm simulator gives only
the marked items with almost the same probability. The discrepancy is due to the
statistical nature of the simulation. The IBM computer gives less accurate results
but still the marked items have appreciably more probability than non-marked items.

17
(a) Local Qasm simulator (b) ibmq santiago quantum computer

Figure 3.8 3-qubit Grover circuit search results on local simulator vs quantum com-
puter

3.2.3 4-qubit circuit


We are searching for |1001y , |1010y , |1100y, and |1111y states. The circuit is shown
in figure 3.9 in both block and gate levels.

18
Figure 3.9 4-qubit Grover circuit in both block and gate levels

The simulation results are as shown below. The results of the Qasm simulator are
still very good. However, the results from the IBM computer are very random. The
reason is that the IBM circuit has a lot of noise introduced due to the depth (the
number of gates) of the circuit and the inherent inaccuracy of the gates.

19
(a) Local Qasm simulator (b) ibmq valencia quantum computer

Figure 3.10 4-qubit Grover circuit search results on local simulator vs quantum com-
puter

3.3 Comparing with literature


For the 4 qubit system, the real quantum computer results in this paper resemble
very much the results from the literature [5]. In fact, we are still living in the noisy-
intermediate-scale quantum computer era, where the long circuits are not still efficient
when implemented on real quantum computers.

Figure 3.11 4-qubit Grover circuit search results as found in [5]

We have seen that it is theoretically possible for quantum algorithms to achieve


speed ups compared to classical algorithms. Also, that is practically good for few
qubits only. For large number of qubits, our circuits gets long in terms of the number

20
of gates which introduces higher accumulated probability of error. Let us see what
else we can do on a quantum computer.

21
Chapter 4

Quantum Simulation of
Schrödinger’s Equation

One area where quantum computing is superior to classical computing is the quantum
simulation of Schrödinger’s equation. According to Richard Feynman, the classical
simulation of a system of n quantum particles requires large memory of order Op2n q[2].
Quantum simulation is promising as it requires only a polynomial number of qubits.
We have a system described by the abstract state vector denoted |ψy in the Dirac
notation. This vector evolves in time according to Schrödinger’s equation.
B
H|ψptqy “ i~ |ψptqy. (4.1)
Bt
1
We assume m “ 2
and ~ “ 1. The solution of the equation is given by:

|ψptqy “ e´iHt |ψinit y . (4.2)

The general Hamiltonian operator H is complicated. In the case of many interact-


ing particles, H involves many interaction terms. We focus on the simulation of one
particle in a single dimension under some potential field. In this case, the Hamiltonian
is given by:

p2
H “K `V “ ` V pxq (4.3)
2m
The exponential operator Ut “ e´iHt is called the evolution operator. It is hard to
implement this operator directly in the qiskit simulation. We note that the evolution
operator cannot be written as a multiplication of two operators using the law of
exponents.
Ut ‰ e´iKt e´iV t
. This is because the kinetic and potential terms do not commute: rK, V s ‰ 0. How-
ever using Trotter formula [2] we can approximate Ut to a multiplication of simpler
(easier to implement) operators to any accuracy.

22
Ut “ e´ipK`V qt
´ ¯t
´iK∆t ´iV ∆t Op∆t2 q ∆t
“ e e e (4.4)
´ ¯t
Op∆t2 q ∆t
“ U∆t e ,

where
U∆t “ e´iK∆t e´iV ∆t . (4.5)
To evolve a state for time t. We just choose small enough ∆t and apply the small
t
time evolution operator U∆t ∆t times. Our evolution equation becomes:

|ψptqy “ e´ipK`V qt |ψinit y ,


` ˘t (4.6)
« e´iK∆t e´iV ∆t ∆t |ψinit y .

4.1 Initialization
To simulate the wave function, we must first encode it into a number of qubits. To
do so, we follow the method in [2] and [6]. First we make our space (the x-axis)
discrete and finite. Thus we turn the wave function from a complex function on the
real line to a complex function on a finite set of discrete points. Using n qubits, we
can have N “ 2n space points. The value of the wave function at these points are
encoded in the basis vectors of the n-qubit system. The most left point in space is
encoded in the |00..00y state and the right most point is encoded in the |11..11y state.
It is worth mentioning that the used kind of discretization method which depends
on the discrete Fourier Transform introduced in section 4.4) makes the space circular
or assumes that the wave function is periodic over a period of the set of length 2n .
I.e. the left most point and the right most point are actually neighbors. This will be
illustrated as we show the results of the simulation.
We sample the axis into a finite sequence xk with spacing ∆x. Instead of the wave
function being represented into infinite dimensional Hilbert space, we approximate it
to become:
d{∆x
ÿ
|ψy « ak |k∆xy . (4.7)
k“´d{∆x

4.2 Potential energy term


The potential energy evolution term is diagonal in the x representation and is directly
calculated as

23
´ d
¯
e´iV pk∆xq∆t “ diag e´iV p´dq∆t , e´iV p´d` ∆x q∆t , ..., e´iV p`dq∆t (4.8)

4.3 Kinetic energy term


Unlike the potential energy term, the kinetic energy evolution operator is not diagonal
in the x representation. On the other hand, this operator is diagonal in the p-
representation (where the basis vectors are the states of definite momentum p or
wave number k). Thus, we transform the x-representation of the system to the p-
representation using the quantum Fourier transform (QFT) matrix. We then apply
the diagonal kinetic energy term. Finally, we transform back to the x-representation
using the inverse quantum Fourier transform.

4.4 Quantum Fourier transform


The quantum Fourier transform of a wave function of an n-qubit system utilizes Opn2 q
gates. The circuit is based on the following derivation as found in [4] and [2]:

n ´1
2ÿ
1 n
|xy Ñ e2πixk{2 |ky
2n{2 k“0

1 1
1 ÿ ÿ řn
kl 2´l q
“ ... e2πixp l“1 |k1 . . . kn y
2n{2 k1 “0 kn “0

1 1 n
1 ÿ ÿ â ´l
“ ... e2πixkl 2 |kl y
2n{2 k1 “0 kn “0 l“1
« ff
n 1
1 â ÿ
2´l
“ e2πixkl |kl y
2n{2 l“1 kl “0

n ”
1 â ´l
ı
“ |0y ` e2πix2 |1y ,
2n{2 l“1

to finally arrive at

1 ´ 2πi
x
¯ ´ 2πi
2 x
¯
QF TN |xy “ ? |0y ` e 2 |1y b |0y ` e 2 |1y b . . .
N ´ ¯ ´ ¯
2πi 2πi
b |0y ` e 2n´1 x |1y b |0y ` e 2n x |1y ,
(4.9)

24
,
which can be seen from the final equation to be a series of operations acting on
the individual qubits. The ith term in the tensor product describes the action on the
ith qubit. For example, the 2-qubit QFT can be calculated as following

1 ´ 2πi
¯ ´ 2πi
¯
QF T4 |xy “ ? |0y ` e 2 x |1y b |0y ` e 22 x |1y ,
4
(4.10)

which results in matrix representation as follows


» fi
1 1 1 1
1 1
— i ´1 ´i ffi
QF T4 “ — ffi . (4.11)
2– 1 ´1 1 ´1 fl
1 ´i ´1 i
This gives a nice description of an algorithm to build the circuit as shown in the
figure. We use 4 qubits in this example.

Figure 4.1 4-qubit circuit of the QFT

4.5 Inverse quantum Fourier transform


The inverse circuit can be obtained using the sock-shoe property:

pA1 A2 ...An q´1 “ A´1 ´1 ´1


n An´1 ...A1 .

All of the operators in the QFT are unitary and Hermetion, so they are their own
inverses except the controlled rotation by angle φ, CU pφq, which has an inverse of
CU p´φq. Thus the inverse circuit for 4 qubits is as shown.

25
Figure 4.2 4-qubit of the inverse QFT

4.6 Diagonal phase matrix


The diagonal phase matrix represents a diagonal operator with phase numbers (mag-
nitude = 1) along the diagonal. For example, the potential energy evolution operator
is a diagonal phase matrix which can be implemented by the circuit as shown in [7].
Here the k th basis vector is written in binary expansion.

k “ kn´1 2n´1 ` ¨ ¨ ¨ ` k1 2 ` k0 , (4.12)

c ˜ ¸
n
1 φ ÿ
k̂ “ ´ 1` 2n´j Ẑj , (4.13)
22n´3 ∆t j“1

where φ is the phase shift acquired in the evolution process (“ E0~∆t )


¨ ˜ ¸2 ˛
n
´ ¯ iφ ÿ
exp ´ik̂ 2 ∆t “ exp ˝ 2n´3 1 ` 2n´j Ẑj ‚ (4.14)
2 j“1

The expansion of the last equation gives a recipe of building the corresponding
circuit for any number of qubits. For example, the circuit for 4 qubits for φ “ π is
shown.

26
Figure 4.3 4 qubit diagonal phase circuit for quadratic potential

4.7 The potential term


The potential operator is a diagonal operator. In this thesis, two potential terms
are implemented: the harmonic potential and the linear potential. The harmonic
potential term is quadratic just like the kinetic term. The linear potential has x
dependency instead of x2 in equation 4.14 in the exponent.
˜ ˜ ¸¸
n
´ ¯ iφ ÿ
exp ´ik̂∆t “ exp 2n´3
1` 2n´j Ẑj . (4.15)
2 j“1

So based on a similar expansion of the previous equation, the circuit for the
harmonic and linear potentials for 4 qubits looks like:

Figure 4.4 4 qubit diagonal phase circuit for linear potential

27
4.8 The time evolution circuit
The previous operators can be combined together to compose the goal evolution
operator:
ˆ ˙
i p2
´1 ´ ~ ∆t i
|ψptqy “ QF T e 2m
QF T e´ ~ V pxq∆t |ψinit y , (4.16)

, which has the corresponding circuit:

Figure 4.5 The block diagram of the evolution circuit [7]

This is the evolution for just one time step. For several time steps, we repeat the
one time step circuit several times as indicated by the returning arrow.

28
Chapter 5

Simulation Results

5.1 Free particle


For a free particle system, the potential is 0. Only the kinetic energy term appears
in the evolution equation.
We simulated a free a particle system on 6 and 7 qubits exclude the discretization
errors. In each simulation, we make sure we get results similar to those known from
quantum mechanics. There is only one time step because there is no potential operator
involved. In that case there is no need to divide the time into several smaller time
steps.

5.1.1 Dispersing Gaussian


We know from QM that a wave function of a particle concentrated in space disperses
as time passes. In other words, the width of a Gaussian function increases with time.
The initial function is given by
1 1 x´µ 2
|ψpxqy “ ? e´ 2 p σ q . (5.1)
σ 2π

The results of the simulation for 3 time steps [time of the step is ∆t “ 0.5π 1 , σ
2
“ 8 basis vectors 3 ] are shown. For simulation with 6 qubits, we get the expected
dispersion as shown in figure 5.1.
1
in the sense that that system is periodic in time over 2π period
2
(The Gaussian drops to half its max value as we move 8 space steps from the center)
3
each vector represents a point in space

29
Figure 5.1 free particle state evolution, n “6, ∆t “ 0.5π

For simulation with 7 qubits [normalized ∆t “ π, σ “ 8 basis vectors], we get


essentially the same behavior but with a better space resolution of a continuous
Gaussian as shown in figure 5.2.

Figure 5.2 free particle state evolution, n “7, ∆t “ π

30
5.1.2 Moving Gaussian
If the wave function has an expectation value of momentum which is not zero, the
wave packet moves with this momentum. The results are shown below for 6 and 7
qubits. The moving Gaussian with average momentum p has the equation,
1 1 x´µ 2
|ψpxqy “ ? e´ 2 p σ q eipx . (5.2)
σ 2π

For 6 qubits [n “6 4 , ∆t “ 12.5π, σ = 8, k “ 1 5 ], we observe motion to the right


with constant velocity of the center. We also note dispersion with time.

Figure 5.3 moving particle state evolution, n “6, ∆t “ 12.5π

Notice the peak position moves with a constant velocity to the right. The peak
position as a function of time is obtained in figure 5.4.
4
n is the number of qubits
5
k “ ~p is the wave vector

31
Figure 5.4 peak position moving in time

For 7 qubits [n “7, ∆t “ 50π, σ = 16, k “ 1], we have similar results.

Figure 5.5 moving particle state evolution, n “7, ∆t “ 50π

Notice the peak position moves with a constant velocity to the right. The peak

32
position as a function of time is obtained in figure 5.6.

Figure 5.6 peak position moving in time

Notice as the particle moves to the extreme right, it emerges from the extreme left
as shown in the green curve. This is because there is a periodic boundary condition
implicitly coming from the QFT. This means that our x-space is actually a circle and
the particle is actually living on a ring instead of a line extending both ways.

5.1.3 Stationary sinusoidal


For an eigenstate of the free particle Hamiltonian, we expect no dynamics. In that
case, the eigenstate is either a travelling wave eikx or a standing wave cospxq “
1 ikx
2
pe ` e´ikx q.
For 6 qubits, the plots at all time steps are identical, which means no change in
the wave function from one instant of time to the next.

33
Figure 5.7 stationary sinusoidal state evolution, n “6, ∆t “ π

For 7 qubits, we get similar results.

Figure 5.8 stationary sinusoidal state evolution, n “7, ∆t “ π

34
5.2 Harmonic potential
The harmonic oscillator is one of the most important systems in quantum mechanics
as many potentials are well approximated by a quadratic potentials for small oscilla-
tions near their minima.
The harmonic potential is given by V pxq “ apx ´ bq2 for some a and b that
determine the strength and the center of the potential respectively. The graph of the
potential is shown in the following figure.

Figure 5.9 harmonic potential

5.2.1 Coherent state


Coherent states 6 are non-dispersive states that mimic the classical harmonic oscil-
lator. They retain their shape as time passes and their expectation of space evolves
classically. Coherent states have the form of
1 1 x´µ 2
|ψpxqy “ ? e´ 2 p σ q eipx . (5.3)
σ 2π

The coherent state is a shifted Gaussian of certain width σ and has a momen-
tum term as per equation 5.3 [8], where µ represents the initial displacement, and p
represents the initial momentum. In this simulation, we use p “ 0.
For 10 qubits [number of iterations 7 “ 128, σ “ 15.2], we observe expected
harmonic oscillation as shown in the following figure.
6
Coherent states are the eigenstates of the annihilation operator [8]
7
This is t{∆t. If we increase the number of iterations, we get a better approximation of the
evolution operator.

35
Figure 5.10 coherent state, n “10, ∆t “ 200π, number of iterations “ 128 per each
time step

Notice the distances the curve moves in each time step to observe its velocity and
acceleration. The peak position oscillates in time as shown in figure 5.11

Figure 5.11 peak position oscillating in time

36
Also observe the shape of the potential as in figure 5.9. As the particle is released
from rest at the left, it gains some velocity to the right. This velocity increases as the
particle goes through the center of the potential. The particle then decelerates and
finally moves to the left.
For 10 qubits [number of iterations “ 4, σ “ 15.2], we see that the Gaussian does
not retain its shape although it has similar oscillation. This is because the time step
is so big because the number of iterations = 4 is so small compared to the first case.
In that case the Trotter’s approximation is not good enough.

Figure 5.12 coherent state time evolution, n “10, ∆t “ 200π, number of iterations
“ 4. the Gaussian does not retain its shape due to large time steps

For 10 qubits [number of iteration “ 128, σ “ 10], we see again that the Guassian
does not retain its shape. This time is due the the fact that width = 10 is not the
right width for the coherent state.

37
Figure 5.13 coherent state of wrong width evolving in time, n “10, ∆t “ 200π,
number of iterations “ 128 per each time step, dissipating because the the width is
not the right σ for coherent state

The width σ depends on the relative strength of the potential term to the kinetic
energy term. If the potential energy increases by ratio α4 , while the kinetic energy
stays the same, we expect the width of the coherent state to change by α1 .For example,
if we increase the potential to 16 “ 24 times, we expect the width of the coherent
state to decrease to half its value. When we adjust the simulation parameters for this
new scenario, we get the expected results.

38
Figure 5.14 coherent state evolving in time, n “10, ∆t “ 200π, number of iterations
“ 128 per each time step, σ “ 7.6

We notice that the period of oscillation is different from figure 5.10. This is
explained by the fact that the spring constant has changed when we change the
strength of the potential. The peak of the packet is plotted as a function of time in
figure 5.15.

39
Figure 5.15 peak position oscillating in time

5.3 Linear potential


The linear potential represents a constant force that accelerates particles under their
influence. It is given by V pxq “ a ´ bx, where b represents the strength of the force.
The graph is shown in the following figure.

Figure 5.16 linear potential

40
5.3.1 Accelerating particle
If we release a particle from the left of the potential shown in figure 5.16, we expect
the wave packet will spread while accelerating. For the 10-qubits circuit, we get
the expected results. Notice that the peak of the curve moves bigger distances in
consecutive time steps as shown in figure 5.16.

Figure 5.17 Gaussian in linear potential evolving in time, n “10, ∆t “ 200π, number
of iterations “ 128

Figure 5.18 depicts the acceleration of the peak of the packet with time.

41
Figure 5.18 peak position accelerating in time

5.4 Simulation on IBM computer


All of the simulations shown previously are done on a local state vector simulator
from the qiskit library. This simulator takes the initial state and the circuit and
outputs the final state. To simulate a free moving particle on quantum computer,
we use a 3-qubit version (+1 additional ancilla qubit) that is able to run on 5-qubit
quantum computer (ibmqx2, for example).
Below is the expected behaviour in the state vector simulation found in the Qiskit
library.

42
Figure 5.19 moving free particle implemented on a 3-qubit circuit simulated using the
state vector simulation

However, when the quantum simulation is implemented on the IBM computer,


the final state is obtained as in figure 5.20

43
Figure 5.20 Initial state (red) and final state (blue) of a moving free particle on a
3-qubit circuit run on ibmqx2

As per figure 5.19, we notice a discrepancy between the IBM computer and the
local simulator results. We conclude that the real quantum computer simulation is
not yet reliable to simulate relatively complex dynamics. When we extracted the
circuit used for implementing the previous simulation from the IBM jobs, it was so
long as shown in the figure 5.21. This is probably the reason for the large errors. The
small errors of the individual gates accumulate to big error in long circuits.

44
Figure 5.21 Long circuit of implementing a moving particle in IBM computers

45
Chapter 6

Recommendation for Future


Research

On the hardware side, we have noticed quantum noise affecting large circuit sim-
ulations. It is therefore important to study the compilation of the qiskit code to
IBM circuits and try to optimize it for specific quantum computers. This will po-
tentially reduce the depth of the circuit and hence the errors. Moreover, we can
understand quantum computers even better if we are able to simulate noisy gates
locally and understand how the depth and the interaction between gates affect the
errors. On the software side, the next step in this research is to study the simulation
of multi-particle systems with interactions between the particles. There are so many
interesting systems of this kind like the spin model.

46
Chapter 7

Conclusion

It has been shown that several quantum algorithms could be implemented and run
locally with results agreeing with those known from quantum mechanics. The local
simulator gives expected results for small and large number of qubits (2 ď n ď 10).
However the IBM computers give only good resuls for circuits with small number of
qubits n ď 3. Nevertheless, it is still an important issue that we study quantum sim-
ulations and run them locally. This allows us to learn about the great potential of the
quantum computational capabilities. We then become prepared to run very computa-
tionally demanding simulations on real quantum computers when they become more
versatile and noise free. Good preparation puts us on the path to achieve quantum
supremacy, a point when quantum algorithms outperform classical algorithms in real
implementations.

47
Bibliography

[1] A. Adedoyin, J. Ambrosiano, P. Anisimov, A. Bärtschi, W. Casper, G. Chennu-


pati, C. Coffrin, H. Djidjev, D. Gunter, S. Karra, et al., “Quantum algorithm
implementations for beginners,” arXiv preprint arXiv:1804.03719, 2018.

[2] M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Informa-


tion. Cambridge University Press, 2000.

[3] M. Abouelela, “Quantum simulation of the schrodinger equation using ibm’s quan-
tum computers,” 2020.

[4] H. Abraham et al., “Qiskit: An open-source framework for quantum computing,”


2019.

[5] Y. Wang and P. S. Krstic, “Prospect of using grover’s search in the noisy-
intermediate-scale quantum-computer era,” Physical Review A, vol. 102, no. 4,
p. 042609, 2020.

[6] G. Benenti and G. Strini, “Quantum simulation of the single-particle schrödinger


equation,” American Journal of Physics, vol. 76, no. 7, pp. 657–662, 2008.

[7] A. M. F. Rodrigues, Validation of quantum simulations: assessing efficiency and


reliability in experimental implementations. PhD thesis, 2018.

[8] J. J. Sakurai and E. D. Commins, “Modern quantum mechanics, revised edition,”


1995.

GitHub link to the code used for the simulations: Click here
or visit: https://github.com/Eltohfa/Thesis-Physics.git

48

You might also like