Вы находитесь на странице: 1из 6

5Uebung

May 22, 2014


1

Ubung 5 - Computational Physics
Luca Gonzalez
Fernando Nu~nez
In [71]: import matplotlib.pyplot as plt
import numpy as np
%config InlineBackend.figure_format = svg
1.1 Exercise
We rst start with the time independent Schrodinger equation:

(z) +
2m

2
(E V (z)) (z) = 0
in our case the potential is given by:
V (z) = mgz
for z 0. If we now dene a scaling factor:
R :=


2
2m
2
g

1/3
and the dimensionless quantities:
x(z) :=
z
R
; :=
E
mgR
So that we get the equation:

(x) + ( x) (x) = 0
Where we can identify k(x) = x. We now proceed to write the corresponding code. We will create a
function called numerov so that we can use it later without having to write the code again.
In [69]: def numerov(E):
fig = plt.figure(figsize=(10, 12)) # Final figure size
for j in range(len(E)):
e = E[j] # Epsilon
n = 1000 # Number of steps
d = 15.0/n # x = 15 limit will be changed for the different parts
z = zeros([n], float)
k = zeros([n], float)
1
psi = zeros([n], float)
z[0] = 0
k[0] = e-z[0]
psi[0] = 0
z[1] = z[0]+d
k[1] = e-z[1]
psi[1]= 1
# Numerov code
for i in range(1,n-1):
z[i+1] = z[i]+d
k[i+1] = e-z[i+1]
psi[i+1] = (2*(1-5/12*d**2*k[i])*psi[i]-(1+d**2*k[i-1]/12)*psi[i-1])/(1+d**2*k[i+1]/12)
# Plots
ax = plt.subplot(5,2,j+1)
plt.plot(z, psi, label = r$\epsilon = %.2f$%e)
plt.axhline(0, color = k)
plt.xlabel($z$)
plt.ylabel($\psi(z)$)
plt.legend(loc=upper left)
show()
We can now select two dierent values for and see the asymptotic behaviour asked:
In [68]: numerov([2,6])
As we can see, for = 2 we have an asymptotic behaviour going to positive innity and for = 6 to
negative innity.
1.2 Exercise
We will now try to estimate the three rst eigenvalues
n
to 2 decimals behind the comma. The eigenvalues
make (x) 0 when x . These will be inside an interval cointaining the change of the asymptotic
behaviour of the solution for large x from positive innity to negative or vice versa. We rst plot a large
range so we can locate approximately where these changes will be produced. A later plot will be made to
give the accuracy asked.
2
In [60]: numerov(np.linspace(1, 10, 10))
In [50]: numerov(np.linspace(4.2, 4.29, 10))
3
We can now see how the tendency of the function changes when raising from 4.24 to 4.25, we can then
asume that
1
(4.24, 4.25).
In [55]: numerov(np.linspace(7.4, 7.49, 10))
4
With the same reasoning:
2
(7.42, 7.43).
In [70]: numerov(np.linspace(10, 10.09, 10))
5
And so for
3
(10.03, 10.04).
6

Вам также может понравиться