Shrodprob stuff

master
E. Almqvist 3 years ago
parent 2099f715c9
commit cc12437725
  1. BIN
      mas/shrodequ_superpos/__pycache__/phys_const.cpython-310.pyc
  2. BIN
      mas/shrodequ_superpos/__pycache__/phys_func.cpython-310.pyc
  3. 21
      mas/shrodequ_superpos/main.py
  4. 4
      mas/shrodequ_superpos/phys/__init__.py
  5. 0
      mas/shrodequ_superpos/phys/__main__.py
  6. BIN
      mas/shrodequ_superpos/phys/__pycache__/__init__.cpython-310.pyc
  7. BIN
      mas/shrodequ_superpos/phys/__pycache__/box.cpython-310.pyc
  8. BIN
      mas/shrodequ_superpos/phys/__pycache__/const.cpython-310.pyc
  9. BIN
      mas/shrodequ_superpos/phys/__pycache__/func.cpython-310.pyc
  10. BIN
      mas/shrodequ_superpos/phys/__pycache__/particle.cpython-310.pyc
  11. 9
      mas/shrodequ_superpos/phys/box.py
  12. 26
      mas/shrodequ_superpos/phys/const.py
  13. 17
      mas/shrodequ_superpos/phys/func.py
  14. 11
      mas/shrodequ_superpos/phys/particle.py

@ -0,0 +1,21 @@
#!/usr/bin/python3
import matplotlib.pyplot as plt
import numpy as np
from phys import *
x = np.arange(0, BOX_LENGTH, 0.00001)
n = np.arange(1, 10, 1)
X, N = np.meshgrid(x, n)
P = prob(X, N)
fig = plt.figure()
ax = plt.axes(projection='3d')
ax.plot_surface(X, N, P, rstride=1, cstride=1, cmap='viridis', edgecolor='none')
ax.set_xlabel('x [m]')
ax.set_ylabel('n [int]')
ax.set_zlabel('probability [frac]');
plt.show()

@ -0,0 +1,4 @@
from phys.func import *
from phys.const import *
from phys.box import box
from phys.particle import particle

@ -0,0 +1,9 @@
from phys.particle import particle
class box:
def __init__(self, length: float):
self.length = length
def add_particle(pobj: particle):
pass

@ -0,0 +1,26 @@
import numpy as np
from scipy.constants import Planck, electron_mass
# constants
BOX_LENGTH = 0.01 # box length (meters)
h = Planck # plancks constant
D = np.sqrt(2/BOX_LENGTH) # norm factor
m = electron_mass # mass
# total energy function
def energy(n):
return (((h*n)/BOX_LENGTH)**2)*(1/(8*m))
# Wave func inner coef
def k(n):
return np.sqrt( (8 * ((np.pi)**2) * m * energy(n))/(h**2) )
# pre calculate energy states
energy_states = []
for n in range(0, 11):
energy_states.append( energy(n) )
psi_k = []
for n in range(0, 11):
psi_k.append( k(n) )

@ -0,0 +1,17 @@
import cmath
import numpy as np
from phys.const import *
# wave function
def psi(x, n) -> float:
return D * np.sin( k(n) * x )
def psi_opt(x, n) -> float: # optimized version
return D * np.sin( psi_k[n] * x )
# probability density function
def prob(x, n) -> float:
return (psi(x, n))**2
def prob_opt(x, n) -> float: # optimized version
return abs(psi_opt(x,n)) ** 2

@ -0,0 +1,11 @@
from phys.func import psi, prob, E
class particle:
def __init__(self, mass: float, n_state: int):
self.mass = mass
self.n_state = n_state
self.energy =
Loading…
Cancel
Save