diff --git a/mas/shrodequ_superpos/__pycache__/phys_const.cpython-310.pyc b/mas/shrodequ_superpos/__pycache__/phys_const.cpython-310.pyc new file mode 100644 index 0000000..c80850b Binary files /dev/null and b/mas/shrodequ_superpos/__pycache__/phys_const.cpython-310.pyc differ diff --git a/mas/shrodequ_superpos/__pycache__/phys_func.cpython-310.pyc b/mas/shrodequ_superpos/__pycache__/phys_func.cpython-310.pyc new file mode 100644 index 0000000..178b31c Binary files /dev/null and b/mas/shrodequ_superpos/__pycache__/phys_func.cpython-310.pyc differ diff --git a/mas/shrodequ_superpos/main.py b/mas/shrodequ_superpos/main.py new file mode 100755 index 0000000..d05a823 --- /dev/null +++ b/mas/shrodequ_superpos/main.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() + + diff --git a/mas/shrodequ_superpos/phys/__init__.py b/mas/shrodequ_superpos/phys/__init__.py new file mode 100644 index 0000000..24de9b4 --- /dev/null +++ b/mas/shrodequ_superpos/phys/__init__.py @@ -0,0 +1,4 @@ +from phys.func import * +from phys.const import * +from phys.box import box +from phys.particle import particle diff --git a/mas/shrodequ_superpos/phys/__main__.py b/mas/shrodequ_superpos/phys/__main__.py new file mode 100644 index 0000000..e69de29 diff --git a/mas/shrodequ_superpos/phys/__pycache__/__init__.cpython-310.pyc b/mas/shrodequ_superpos/phys/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000..95dbd8d Binary files /dev/null and b/mas/shrodequ_superpos/phys/__pycache__/__init__.cpython-310.pyc differ diff --git a/mas/shrodequ_superpos/phys/__pycache__/box.cpython-310.pyc b/mas/shrodequ_superpos/phys/__pycache__/box.cpython-310.pyc new file mode 100644 index 0000000..d287653 Binary files /dev/null and b/mas/shrodequ_superpos/phys/__pycache__/box.cpython-310.pyc differ diff --git a/mas/shrodequ_superpos/phys/__pycache__/const.cpython-310.pyc b/mas/shrodequ_superpos/phys/__pycache__/const.cpython-310.pyc new file mode 100644 index 0000000..ff4b286 Binary files /dev/null and b/mas/shrodequ_superpos/phys/__pycache__/const.cpython-310.pyc differ diff --git a/mas/shrodequ_superpos/phys/__pycache__/func.cpython-310.pyc b/mas/shrodequ_superpos/phys/__pycache__/func.cpython-310.pyc new file mode 100644 index 0000000..fc4dc39 Binary files /dev/null and b/mas/shrodequ_superpos/phys/__pycache__/func.cpython-310.pyc differ diff --git a/mas/shrodequ_superpos/phys/__pycache__/particle.cpython-310.pyc b/mas/shrodequ_superpos/phys/__pycache__/particle.cpython-310.pyc new file mode 100644 index 0000000..28d76dc Binary files /dev/null and b/mas/shrodequ_superpos/phys/__pycache__/particle.cpython-310.pyc differ diff --git a/mas/shrodequ_superpos/phys/box.py b/mas/shrodequ_superpos/phys/box.py new file mode 100644 index 0000000..4b0f2fb --- /dev/null +++ b/mas/shrodequ_superpos/phys/box.py @@ -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 + diff --git a/mas/shrodequ_superpos/phys/const.py b/mas/shrodequ_superpos/phys/const.py new file mode 100644 index 0000000..f1b529b --- /dev/null +++ b/mas/shrodequ_superpos/phys/const.py @@ -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) ) diff --git a/mas/shrodequ_superpos/phys/func.py b/mas/shrodequ_superpos/phys/func.py new file mode 100644 index 0000000..a63247e --- /dev/null +++ b/mas/shrodequ_superpos/phys/func.py @@ -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 diff --git a/mas/shrodequ_superpos/phys/particle.py b/mas/shrodequ_superpos/phys/particle.py new file mode 100644 index 0000000..72db7a5 --- /dev/null +++ b/mas/shrodequ_superpos/phys/particle.py @@ -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 = + + +