Skip to content

Instantly share code, notes, and snippets.

@Himenon
Created October 16, 2015 02:28
Show Gist options
  • Save Himenon/505239092181422a1f16 to your computer and use it in GitHub Desktop.
Save Himenon/505239092181422a1f16 to your computer and use it in GitHub Desktop.
#from sympy import *
import numpy as np
import pylab as plt
class quantumEnergy:
def __init__(self):
self.electron_mass = 9.1E-31 # kg
self.elem_charge = - 1.6E-19 # eV
self.pi = np.pi
self.permittivity = 8.9E-12
self.plank_const = 1.05E-34 # J s
def energy(self, n):
En = - self.electron_mass * self.elem_charge ** 4
En /= 32 * self.pi ** 2 * self.permittivity ** 2 * self.plank_const ** 2
En /= n ** 2
return En / self.elem_charge
if __name__ == '__main__':
hydrogen = quantumEnergy()
x = np.arange(1, 20)
y = hydrogen.energy(x)
plt.xlabel("Number (n)")
plt.ylabel("Energy [eV]")
plt.scatter(x, y)
plt.show()
@Himenon
Copy link
Author

Himenon commented Oct 16, 2015

This program equation is following equation solve.
$$E_n = -\frac{m_e e^4}{32 \pi \epsilon_0 \hbar^2} \frac{1}{n^2}$$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment