[PYTHON] Read "Quantum computer made in 14 days". First day

Introduction

I bought a book called "Quantum Computer in 14 Days" from today, so I would like to deepen my understanding of quantum computers while implementing it. This book will take 14 days to finally implement a simple quantum computer simulator. I'm more of a theory-oriented person, and I don't understand quantum mechanics at all, but I'd like to read it somehow. This time, we will read up to the basics of quantum mechanics.

0 Environment construction

Here, Python environment construction, numerical calculation, and figure drawing are performed.

0.1 Python, module installation

The version of Pyhthon is expected to be 3.8.2. For the installation method, install the installer from the official website (https://www.python.org/downloads/). ·download ·Answer ・ Installation It can be done in three stages. You should refer to other sites for this. The next external module to use in Python is

numpy:A module that mainly performs matrix calculations. Important
scipy:A module that performs scientific calculations. Use for the first time. Important
matplotlib:A module that draws graphs. Important

These installations can be done with the following command

$ pip install numpy scipy matplotlib

0.2 Basics of numerical calculation

I've never used Scipy, so I'll leave a sample script for it. Books also integrate appropriate functions.

sample.py


import scipy.integrate as integrate
import math

#Integral interval
x_min = 0
x_max = 1

#Graph to be integrated
def func(x):
    return math.exp(x)

#Theoretical integration result
exact = math.e - 1

#Integral operation
result, err = integrate.quad(func, x_min, x_max)

print("Integral result:" + str(result))
print("Calculation error:" + str(result - exact) + " (Estimated error:" + str(err) + ")")

When I ran this, it turned out like this.

$ python sample.py
>Integral result: 1.7182818284590453
>Calculation error: 2.220446049250313e-16 (Estimated error: 1.9076760487502457e-14)

1 Basics of quantum mechanics (Schrodinger's equation)

1.1 Wave function

Particles handled by a quantum computer seem to have properties as waves and particles, and in order to handle quantum states due to these properties, a function called a wave function is used. The symbol ψ is used for the wave function.

\begin{array}{l}

\psi(x,y):Wave function\\
x: position\\
y: time

\end{array}

The square of the absolute value of the wave function has the property of expressing the probability that a particle exists at that point. Therefore, the wave function must satisfy the following standardization conditions.

\begin{array}{l}

\S 1.1(Standardization conditions)\\
\int_{-\infty}^{\infty}\left|\psi(x,t)\right|^2dx

\end{array}

1.2 Schrodinger equation

The Schrodinger equation is an equation that determines the behavior of the wave function and is expressed as follows.


\begin{array}{l}
\S 1.2(Schrodinger equation)\\
(1)\quad i\hbar\frac{\partial\psi(x,t)}{\partial t}=\hat{H}(x,t)\psi(x,t)\\ 

i:Imaginary unit\\
\hbar:Dirac constant(1.055\times 10^{-34}[Js])\\
\hat{H}(x,t):Hamiltonian
\end{array}

I will omit the explanation of the imaginary unit. Dirac's constant is Planck's constant (h) divided by 2π. In classical mechanics, the Hamiltonian seems to represent the energy of the system. By attaching a hat to this, it means that it has been converted to quantum mechanics. This hat means that the internal momentum p is replaced by the momentum operator and the position x is replaced by the position operator.

\begin{array}{l}

\S 1.3 (Hamiltonian[Quantum mechanics])\\
(2)\quad\hat{H}=\hat{T}+\hat{V}\\
(3)\quad\hat{T}=\frac{\hat{p}^2}{2m}\\
(4)\quad\hat{V}=V(\hat{x},t)\\
\hat{p}:Momentum operator\\
\hat{x}:Position operator

\end{array}

The wavefunction defined here is defined by the position x and the time t. Such a representation is called position display (coordinate display?). Also, it seems that the method of expressing the wave function by momentum and time is called momentum display. In the case of position display, the momentum operator and position operator can be converted as follows.

\begin{array}{l}

\S 1.4(Position display operator)\\
\hat{p}=\frac{\hbar}{i}\frac{\partial}{\partial x}\\
\hat{x}=x

\end{array}

Here, the position operator and the momentum operator must satisfy the canonical exchange condition. What is a canonical exchange condition?

\begin{array}{l}

\S 1.5(Canonical exchange conditions)\\
[\hat{x},\hat{p}]=\hat{x}\hat{p}-\hat{p}\hat{x}=i\hbar

\end{array}

It seems that the position operator and momentum operator cannot go unless they satisfy the form like ↑.

Based on these, the Schrodinger equation can be rewritten as follows.

\begin{array}{l}

\S 1.6(Schrodinger equation)\\
i\hbar\frac{\partial\psi(x,t)}{\partial t}=\left[-\frac{\hbar^2}{2m}\frac{\partial^2}{\partial x^2}+V(x,t)\right]\psi(x,t)

\end{array}

1.3 When the potential does not depend on time

If the potential does not depend on time, consider ψ as two functions as follows.

\psi(x,t)=\phi(x)T(t)

Here, a solution (separation of variables solution) having such a form is obtained. It seems that you don't have to think about other solutions. I didn't know the reason. Substituting this into Schrodinger's equation

\begin{align}

i\hbar\frac{d(\phi(x)T(t))}{d t} &=& -\frac{\hbar^2}{2m}\frac{d (\phi(x)T(t))}{d x}+V(x)\phi(x)T(t)\\
i\hbar\phi(x)\frac{d T(t)}{d t} &=& -\frac{\hbar^2}{2m}T(x)\frac{d \phi(x)}{d x}+V(x)\phi(x)T(t)

\end{align}

Dividing both sides by ϕ (x) T (t)

i\hbar\frac{1}{T(t)}\frac{d T(t)}{d t}=\frac{1}{\phi(x)}\left[-\frac{\hbar^2}{2m}\frac{d^2 \phi(x)}{d x^2}+V(x)\phi(x)\right]

Looking at the formula, there is a variable only for x on the right side of t on the left side. Since the left and right sides are always equal, both sides are constants. If the constant (separation constant) is set to E here,

\begin{align}

E &=& i\hbar\frac{1}{T(t)}\frac{d T(t)}{d t}\\
E &=& \frac{1}{\phi(x)}\left[-\frac{\hbar^2}{2m}\frac{d^2 \phi(x)}{d x^2}+V(x)\phi(x)\right]

\end{align}

To summarize the above formula,

\frac{d T(t)}{d t}=-\frac{iE}{\hbar}T(x)

Since the derivative of T (x) lacks a constant in T (x), solving this differential equation gives it the form of an exponential function, and using the constant T0,

T(x)=T_{0}e^{-i\omega t}\quad
However\omega=\frac{E}{\hbar}

From this, it can be seen that the wave function has a simple vibration. Also, since Dirac's constant is Planck's constant divided by 2π,

\begin{array}{l}

\S 1.7 (Einstein relations)\\
E=\hbar\omega=hv\\
v:Frequency

\end{array}

Also, by transforming the equation for x, a time-independent Schrodinger equation can be obtained.

\begin{array}{l}

\S 1.8 (Time-independent Schrodinger equation)\\
\left[ -\frac{\hbar^2}{2m}\frac{d^2}{d x^2}+V \right]\phi(x)=E\phi(x)

\end{array}

Such an equation is called an eigen equation, E is the eigenenergy, and φ is the eigenenergy function.

reference

EMAN Physics [Physical computer made in 14 days](https://www.amazon.co.jp/14%E6%97%A5%E3%81%A7%E4%BD%9C%E3%82%8B%E9%87 % 8F% E5% AD% 90% E3% 82% B3% E3% 83% B3% E3% 83% 94% E3% 83% A5% E3% 83% BC% E3% 82% BF% E2% 80% 95 % E3% 82% B7% E3% 83% A5% E3% 83% AC% E3% 83% 87% E3% 82% A3% E3% 83% B3% E3% 82% AC% E3% 83% BC% E6 % 96% B9% E7% A8% 8B% E5% BC% 8F% E3% 81% A7% E9% 87% 8F% E5% AD% 90% E3% 83% 93% E3% 83% 83% E3% 83 % 88% E3% 83% BB% E9% 87% 8F% E5% AD% 90% E3% 82% B2% E3% 83% BC% E3% 83% 88% E3% 83% BB% E9% 87% 8F -% E9% 81% A0% E8% 97% A4-% E7% 90% 86% E5% B9% B3 / dp / 4877834702)

Recommended Posts

Read "Quantum computer made in 14 days". First day
Read "Quantum computer made in 14 days". the 2nd day
Read "Quantum computer made in 14 days". Day 5 Quantum well improvement / addition of barriers
Read "Basics of Quantum Annealing" Day 5
Read "Basics of Quantum Annealing" Day 6
Read "Quantum computer made in 14 days". First day
Read "Quantum computer made in 14 days". the 2nd day
Read "Quantum computer made in 14 days". Day 5 Quantum well improvement / addition of barriers
Read "Basics of Quantum Annealing" Day 5
Read "Basics of Quantum Annealing" Day 6
Differentiation in computer
pickle To read what was made in 2 series with 3 series
Differentiation in computer
pickle To read what was made in 2 series with 3 series