fork download
  1. import matplotlib.pyplot as plt
  2.  
  3. def spectra(n1, n2):
  4. rh = 1.097e7
  5. inv_lambda = rh * ((1 / (n1**2)) - (1 / (n2**2)))
  6. wavelength = 1 / inv_lambda * 1e9
  7. return wavelength
  8.  
  9. n1 = 1
  10. n2 = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
  11. wave = [spectra(n1, n) for n in n2]
  12.  
  13. plt.figure(figsize=(10, 2))
  14. for w in wave:
  15. plt.axvline(x=w, color='red', linestyle='-', linewidth=1)
  16. plt.xlabel('Wavelength (nm)')
  17. plt.title('Lyman Series')
  18. plt.show()
Success #stdin #stdout 2.25s 56796KB
stdin
Standard input is empty
stdout
Standard output is empty