Advertisement
SepandMeenu

Strange Spectrum

Oct 18th, 2018
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. import pylab as plt
  2. import numpy as np
  3.  
  4. '''
  5. plot A_k(w) = 1 / [(w - cos(k))^2 + gamma^2]
  6. with k on the x-axis and w on the y-axis
  7. '''
  8.  
  9. # sample data
  10. side = np.linspace(-np.pi, np.pi, 1<<9)
  11. X, Y = np.meshgrid(side, side) # x = momentum, y = frequency
  12. g0 = 1
  13. Z = 1 / ((Y - np.cos(X))**2 + g0**2) # z = spectrum
  14.  
  15. # plot the density map using nearest-neighbor interpolation
  16. plt.pcolormesh(X, Y, Z)
  17. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement