Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Created on Sat May 30 16:36:44 2015
- @author: ameyah
- """
- from __future__ import division
- import numpy as np
- from numpy import linalg as lin
- #from matplotlib import pyplot as plt
- #from scipy.special import hermite as herm # hermite-polynoms
- # all parameters and stuff
- heff = 0.05
- xmin = -1.5
- xmax = 1.5
- N = 100
- dx = (xmax-xmin)/(N-1)
- x = np.linspace(xmin, xmax, N-1)
- z = heff**2/(2*dx**2)
- #wtf is V? lets say V=0.5*x**2 here harmonic oscillator as example
- V=0.5*x**2
- A=0.04
- def H(V,z,A,N,dx):
- return (np.diag(V(xmin + np.arange(1, N)*dx, A) + 2*z) +
- np.diag(-np.ones(N-2)*z, -1) + np.diag(-np.ones(N-2)*z, 1))
- # brackets because to separate 2 lines of code for the return
- ew, ev = lin.eigh(H) # 0-dim array given, linalgerror :/ any ideas?!
- #plt.plot(x,V)
- #def eigen(H):
- # [ev, ew] = la.eigh(H)
- # return [ev, ew]
- #print potential(0.05, np.linspace(x_min, x_max, delta))
- #print
- #[ew, ev] = matrix.Eigen
- #print ew
- # test if Eigenvalues are normed to 1, hmm this works
- #print np.sum(np.abs(ev[:, i])**2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement