0% found this document useful (0 votes)
33 views

Python Program Schrodinger Equation Potential

The document presents a numerical method to solve the Time-Independent Schrödinger Equation (TISE) for a double well potential defined by V(x)=x^4−4x^2. It includes a Python implementation that calculates eigenvalues and eigenfunctions using matrix diagonalization. The results are visualized using matplotlib to plot the first two eigenfunctions.

Uploaded by

r09507001
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Python Program Schrodinger Equation Potential

The document presents a numerical method to solve the Time-Independent Schrödinger Equation (TISE) for a double well potential defined by V(x)=x^4−4x^2. It includes a Python implementation that calculates eigenvalues and eigenfunctions using matrix diagonalization. The results are visualized using matplotlib to plot the first two eigenfunctions.

Uploaded by

r09507001
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

V(x)=x4−4x2.

−d2ψ(x)dx2+V(x)ψ(x)=Eψ(x)

import numpy as np
import matplotlib.pyplot as plt

def solveTISE(xmin,xmax,h,potFunc,params):
xvec = np.arange(xmin,xmax,h)
Nx = len(xvec)
potFunctVec = potFunc(xvec,params)
mat = -((np.tri(Nx,Nx,1)-np.tri(Nx,Nx,-2)-3.*np.eye(Nx))/h**2-
np.diag(potFunctVec))
print(mat)
eigenValues,eigenVectors = np.linalg.eig(mat)
idx = eigenValues.argsort()[::1]
eigenValues = eigenValues[idx]
eigenVectors = eigenVectors[:,idx]
return eigenValues,eigenVectors,xvec

def doubleWell(x,params):
return np.piecewise(x, [x < 0, x >= 0], [lambda x : params[2]*(x**4 -
params[0]*x**2), lambda x : params[3]*(x**4 - params[1]*x**2)] )

betaValue = 0.01;
hValue = 0.01;
eigEnergy1i, eigFunc1i, xvec1i = solveTISE(-10,10,hValue,doubleWell,[4,4,1,1]);

plt.plot(xvec1i,eigFunc1i[0]);
plt.show()
plt.plot(xvec1i,eigFunc1i[1]);
plt.show()

You might also like