Computational modeling Lecture 8 : Quantum Mechanics Physics: • Differential equations with boundary conditions • Schrodinger’s cat • Particle in a Box Programming: • Modification of the Pendulum program Instructor : Cedric Weber Course : 4CCP1000
Computational modeling
Lecture 8 : Quantum Mechanics
Physics:
• Differential equations with boundary conditions • Schrodinger’s cat • Particle in a Box
Programming:
• Modification of the Pendulum program
Instructor : Cedric Weber
Course : 4CCP1000
1. Using functions to solve differential equations " "ý""
2. Reading an initial condition from the keyboard ý"
3. Plotting the solution of a differential equation " ý"
4. Modifying a differential equation to introduce friction "ý
2
What did you learn last time?
Class/Week Chapter Topic Milestones
1 Monte Carlo UNIX system / Fortran
2 Monte Carlo Fibonacci sequence
3 Monte Carlo Random variables
4 Monte Carlo Central Limit Theorem
5 Monte Carlo “Monte Carlo” integration Milestone 1
6 Differential equations The Pendulum
7 Differential equations The Taylor’s method
8 Differential equations A Quantum Particle in a box
9 Differential equations The Tacoma bridge Milestone 2
10 Linear Algebra Matrix operations Milestone 3
3
Schedule
* Lecture 1-‐5 : * Statistics and integrals
* Lecture 6-‐7 : * Differential equations with
initial conditions
* Lecture 8 : * The particle in the box : we
will combine do loops functions, and arrays, differential equation with boundary conditions
4
Where are we going?
0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
wee
k 1
wee
k 2
wee
k 3
wee
k 4
wee
k 5
wee
k 6
wee
k 7
wee
k 8
wee
k 9
wee
k 10
Milestone 2 : Solving differential equations
5
Examination
* Examination:
* Sit-‐in : -‐December 12th & December 13th (depending on your group) -‐you can use all your programs, bring all your notes, books, … -‐you will have to solve problems during the 3h
* Report : -‐Deadline end of January -‐10 pages max (including figures) -‐discuss and complete the problems given during the examination (detailed guidelines will be posted on KEATS)
6
7
Today‘s experiment …!
* [ do not repeat this experiment … ]
* Erwin Schrödinger, 1887-‐1961, born in Vienna * Developed the wave equation of quantum mechanics * Idea: every particle (electron, proton..) can be described by a function
* This particle has a probability P(x) to be observed at a point x of space, this probability is given by the function:
* Condition: the probability to observer the particle somewhere (anywhere) has to be P=1 :
8
Schrodinger’s equation
ψ(x)
P (x) = |ψ(x)|2
�P (x)dx =
�|ψ(x)|2dx = 1
* How can we know this function ? To make the connection with the last lecture, we simply change the notation, let’s call this function y(x)
* Answer: the function is the solution of the Schrodinger equation
* m : mass of the particle * E : energy of the particle * x : the coordinate, the position in space of the particle * V(x) : a potential which affects the particle and defines the problem to
solve. If the particle is a rolling ball, the potential V(x) would be the potential energy
* : Plank constant
Differential equation
ψ(x) → y(x)
d2y(x)
dx2=
2m(V (x)− E)
�2 y(x)
�
Let’s be more specific: * Let’s describe the problem of a particle resting in a box * The box has only one dimension (to simply our problem) * The box has infinitely hard walls on each side * The particle is not able to “enter” into the wall, so the probability to find
the particle in x=a and x=b is zero: y(a)=y(b)=0
10
Particle in a box
V (x) = 0Wall Wall
x
a = 0
b = 5V (x) = ∞ V (x) = ∞
x = a x = b
* Shake the box : give an energy E to the particle * Where is the particle? Sitting at the center of the box? * To answer this question, we need to find y(x) in the interval a<x<b * In this interval V(x)=0
* With boundary conditions: (the ball cannot enter the walls)
11
Shake the box?
y(a) = 0 y(b) = 0
d2y(x)
dx2= −2mE
� y(x)
* Shake the box : give an energy E to the particle * Where is the particle? Sitting at the center of the box? * To answer this question, we need to find y(x) in the interval a<x<b * In this interval V(x)=0
* With boundary conditions: (the ball cannot enter the walls)
12
Shake the box?
y(a) = 0 y(b) = 0
d2y(x)
dx2= −2mE
� y(x)
What is the difference with the pendulum?
(last lecture)
* For simplicity, we set the mass of the particle such that : * This is the equation that we have to solve:
* Reminder: Pendulum was a similar problem, but with initial condition. * Here, we need to impose y(a) =y(b)=0. We have a free parameter E. * Idea: can I start from y(a)=0, and find E such that y(b)=0 ?
13
Simplified equation
d2y(x)
dx2= −Ey(x)
2m
� = 1
y(a) = y(b) = 0
y(a) = 0 & E y(b) = 0
² Strategy: aim and shoot
² Solve the differential equation with initial condition y(a)=0
² … and with an energy E, see what you obtain for y(b)
² Obtain y(b) as a function of E, when y(b)=0 we find the right Energy E.
² Find which energies E satisfy the condition y(b)=0 (finding zeros of a function, check where the plot is crossing the horizontal axis) 14
Solving differential equation with boundary conditions
y(x = a) = 0
y(x = b) = 0
² We discussed in the last lecture that this equation can be decomposed in two coupled first order equations:
² Simple idea: let’s define a new variable: ² We get the equations :
² We are trying to obtain : y(b=5)=0 ² Plot what you obtain for y(b=5) for energies E ranging from 0 to 20 15
Reminder : coupled first order equations
Initial conditions
dy
dx= z
d2y(x)
dx2= −Ey(x) y(a) = 0 y�(a) = 1
z(0) = 1
y(0) = 0dz
dx= ....
16
Energy quantization
Each time y(5)=0, we solved our problem! Yay!
d2y(x)
dx2= −Ey(x)
y(0) = y(5) = 0
17
Energy quantization
Each time y(5)=0, we solved our problem! Yay! But Wait…. The energy of the particle only can take SOME particular values right? Indeed, this is what we call the quantification of the energy (hence “quantum” physics) The particle can only take some quantized energies
d2y(x)
dx2= −Ey(x)
y(0) = y(5) = 0
* For each obtained energy E, we can also obtain the solution to the differential equation y(x), 0<x<5
* What do we get? * For each allowed energy:
* First energy (n=1) * Second energy (n=2) * Third energy (n=3)
18
Quantum wave-‐function y(x)
n=1 n=2
n=3
* Probability P(x)=y(x)2
* The particle with first energy has two maxima"
* The particle with second energy has three maxima"
* The particle with third energy has four maxima… "
* When the particle has a high energy it is everywhere ! !
19
Where is my particle?
n=1
n=2
n=3
20
1. We use the code written for the pendulum (last lecture)
2. The function F1 and F2 need to be updated
3. The differential equation needs to be solved for many different energies, we want to scan energies from 0 to 20
4. For each energy E we obtain y(x=5), so we will write into a file : E , y(x=5)
21
Finding the energies
22
module library!"contains!" function F1( y , z , E)" implicit none" real(8) :: F1" real(8) :: y , z , E " F1= [ FILL IN ]" end function!" function F2(y , z , E)" implicit none" real(8) :: F2" real(8) :: y , z , E" F2= [ FILL IN ] " end function!"end module!
program quantumbox![FILL IN] !how can you use the module “library”?"implicit none""integer,parameter :: N=100000"integer :: j,i, iE"real(8) :: h,a,b ,energy"real(8) :: x(0:N),y(0:N),z(0:N)"" a = 0.0" b = 5.0" h = (b - a) / dble(N)" " do iE=1,1000"" energy = ... iE [FILL IN] "" x(0)=a; y(0)=0; z(0)=1." do j = 1, N" y( j ) = y( j-1 ) + h * F1( [Fill in] )" z( j ) = z( j-1 ) + h * F2( [Fill in] )" x( j ) = j*h" enddo"" write(100,*) energy, [FILL IN]"" end do""end program"
MODULE
PROGRAM Main structure of the code
Solve the equ. diff. for every energy
23
program quantumbox![ FILL IN ]!implicit none"integer,parameter :: "N=100000"integer :: "j , i , iE "real(8) :: "h , a, b, energy"real(8) :: "x(0:N) , y(0:N) , z(0:N)"" a = 0.0" b = 5.0" h = (b - a) / dble(N)"" do iE=1,1000"" energy = ... iE [FILL IN]!" x(0)=a; y(0)=0; z(0)=1."" do j = 1, N"" y( j ) = y( j-1 ) + h * F1 ( [Fill in] )" z( j ) = z( j-1 ) + h * F2 ( [Fill in] )" x( j ) = j * h"" enddo"" write(100,*) energy, [FILL IN]!" end do""end program"
Main structure of the code
Solve the differential equation for every energy E
Solve the differential equation one energy E
The solution y(x) is stored in the array y( j ) , j=1,N
* We modify bits in the previous code, now additionally we want to detect each time y(x) satisfies y(x=5)=0
* We add a counter countE, which is incremented each time we obtain : y(x=5)=0
* how can I detect if y(x=5) is equal to zero ?
24
Plotting the quantum functions
25
program quantumbox!use library"implicit none" real(8) ":: yb( 0:N ) ……." yb=0.0! countE = 0!" do iE = 1 , 1000"" energy = ... iE [ FILL IN ] !" x(0)=a; y(0)=0; z(0)=1."" do j = 1, N" y(j) = y(j-1) + h * F1( [Fill in] )" z(j) = z(j-1) + h * F2( [Fill in] )" x(j) = j * h" enddo"" yb(i)=y(N)!! if( yb(i) * yb(i-1) [...FILL IN...] )then!! [Fill in]!! end if!"" end do""end program"
y(N) is the last point obtained for the solution of the equation, so y(N) is y(x=5)
countE counts how many times we obtain y(x=5)=0 as the energy is increased. It will hence count the energy levels for the wave-‐function
Here we want to check if y(x=5) is equal to zero. When it is, we want to write into a new file the array “y” which contains the solution y(x) for this given energy E
Problem 1 : Particle in a box
Problem 2 : Infinite box Problem 3 : Particle tunneling through a barrier (optional)
26
Problems
Wall
27
Particle in a box / Energy barrier
Wall
V (x) = ∞ V (x) = ∞V (x) = 0
x = a x = bx
a = 0
b = 5V (x) = 0Wall
V (x) = 5
* Problem 1 : Particle in the box
* Problem 2 : Quantum free particle (plane wave)
* Problem 3 : Quantum tunneling (optional)
28
Friday, problem session