In [1]:
using PyPlot

Aufgabe 2

Teil a

Das Minimum des verschobenen harmonischen Oszillators liegt bei: $$ \frac {dV} {dx} = m \omega^2 x + \theta \sqrt {2 \frac{m\omega}{\hbar}} \overset{!}{=} 0 \Leftrightarrow x_{min} = - \frac {\theta \sqrt {2 \frac{m\omega}{\hbar}}} {m \omega^2} \\ \Leftrightarrow V_{min} = - \frac{\theta^2}{\omega\hbar} $$ Das Spektrum der Eigenenergien des verschobenen harmonischen Oszillators ist das Spektrum des unverschobenen plus $V_{min}$. $$ E'_n = E_n + V_{min} = \hbar \omega (n+1) - \frac{\theta^2}{\omega\hbar} $$

Teil b


In [2]:
function E(n)
    return n+1
end
function H(theta, N)
    matrix = zeros(N,N)
    for i in 1:N
        matrix[i,i] = E(i-1)
        if i < N
            matrix[i,i+1] = sqrt(i)*theta
            matrix[i+1,i] = sqrt(i)*theta
        end
    end
    return matrix
end
H(1,9)


Out[2]:
9×9 Array{Float64,2}:
 1.0  1.0      0.0      0.0      0.0      0.0      0.0      0.0      0.0    
 1.0  2.0      1.41421  0.0      0.0      0.0      0.0      0.0      0.0    
 0.0  1.41421  3.0      1.73205  0.0      0.0      0.0      0.0      0.0    
 0.0  0.0      1.73205  4.0      2.0      0.0      0.0      0.0      0.0    
 0.0  0.0      0.0      2.0      5.0      2.23607  0.0      0.0      0.0    
 0.0  0.0      0.0      0.0      2.23607  6.0      2.44949  0.0      0.0    
 0.0  0.0      0.0      0.0      0.0      2.44949  7.0      2.64575  0.0    
 0.0  0.0      0.0      0.0      0.0      0.0      2.64575  8.0      2.82843
 0.0  0.0      0.0      0.0      0.0      0.0      0.0      2.82843  9.0    

Teil c


In [6]:
function E_(n, theta)
    return E(n)- theta^2
end
function f(lambda, theta, N)
    A = H(theta,N)
    return det(A-lambda*ones(A))
end
function bisect(f, args=[]) # nur für lineare Funktionen
    a = 1
    while sign(f(a,args...)) == sign(f(-a,args...))
        a *= 2
    end
    left = -a
    right = a
    mid = 0
    while f(mid, args...) > 1e-10
        if f(mid,args...) > 0
            if f(left,args...) > 0
                left = mid
            else
                right = mid
            end
        else
            if f(left,args...) > 0
                right = mid
            else
                left = mid
            end
        end
        mid = (right+left)/2
    end
    return mid
end
lambda = linspace(-5,5)
for omega in linspace(0,2,5)
    plot(lambda, f.(lambda,omega,10)) 
end
show()


WARNING: Method definition E_(Any, Any) in module Main at In[5]:2 overwritten at In[6]:2.
WARNING: Method definition f(Any, Any, Any) in module Main at In[5]:5 overwritten at In[6]:5.
WARNING: Method definition bisect(Any) in module Main at In[5]:9 overwritten at In[6]:9.
WARNING: Method definition bisect(Any, Any) in module Main at In[5]:9 overwritten at In[6]:9.

Ich habe nicht verstanden warum $f(\lambda)$ linear ist.