diff --git a/mas/shrodequ_superpos/main.py b/mas/shrodequ_superpos/main.py index fac4444..d7d0de4 100755 --- a/mas/shrodequ_superpos/main.py +++ b/mas/shrodequ_superpos/main.py @@ -2,22 +2,26 @@ import matplotlib.pyplot as plt import numpy as np from phys import * +from scipy.constants import electron_mass -quantum_system = box(0.001) # box with inf walls +system = infbox(0.001) # box with inf walls -# 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]'); +p1 = particle(electron_mass, system, 1) +p2 = particle(electron_mass, system, 2) + +x = np.arange(0, BOX_LENGTH, 0.00001) +t = np.arange(0, 1, 0.01) # -# plt.show() +X, T = np.meshgrid(x, t) +P = system.get_superpos(X, T) + +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('time [s]') +ax.set_zlabel('probability [frac]'); + +plt.show() diff --git a/mas/shrodequ_superpos/phys/__pycache__/particle.cpython-310.pyc b/mas/shrodequ_superpos/phys/__pycache__/particle.cpython-310.pyc index 6e78f4b..9b1bd87 100644 Binary files a/mas/shrodequ_superpos/phys/__pycache__/particle.cpython-310.pyc and b/mas/shrodequ_superpos/phys/__pycache__/particle.cpython-310.pyc differ diff --git a/mas/shrodequ_superpos/phys/__pycache__/quantum_systems.cpython-310.pyc b/mas/shrodequ_superpos/phys/__pycache__/quantum_systems.cpython-310.pyc index 97b024b..bf5c30a 100644 Binary files a/mas/shrodequ_superpos/phys/__pycache__/quantum_systems.cpython-310.pyc and b/mas/shrodequ_superpos/phys/__pycache__/quantum_systems.cpython-310.pyc differ diff --git a/mas/shrodequ_superpos/phys/quantum_systems.py b/mas/shrodequ_superpos/phys/quantum_systems.py index bf31a46..4feeaa9 100644 --- a/mas/shrodequ_superpos/phys/quantum_systems.py +++ b/mas/shrodequ_superpos/phys/quantum_systems.py @@ -1,4 +1,4 @@ -from phys.particle import particle +#from phys.particle import particle import numpy as np class quantum_system: @@ -6,16 +6,26 @@ class quantum_system: self.name = name self.particles = [] - def add_particle(particle: particle): + def add_particle(self, particle): self.particles.append(particle) - print(f"Added particle {particle} to quantum system '{self.name}'") + print(f"Added particle {particle} to quantum system '{self.name}' ({self})") class infbox(quantum_system): def __init__(self, length: float): - super - self.name = "Inf Box" + super().__init__("Inf Box") self.length = length self.norm_factor = np.sqrt(2/self.length) + def get_superpos(self, x: float, t: float) -> float: + waves = [] + for part in self.particles: + waves.append( part.wave(x, t) ) + + superpos_wave = sum(waves) + + # normalize the superpos #TODO: ????? + # superpos_wave *= 1/abs(superpos_wave) + + return abs(superpos_wave) ** 2