import numpy as np
import matplotlib.pyplot as plt
# Define the parameters
t = 1.0 # Hopping amplitude
N = 50 # Number of lattice sites
phi = np.pi / 4 # Phase factor (example: pi/4)
# Generate the mode indices (1 to N)
n = np.arange(1, N+1)
# Calculate the energy dispersion for each mode n
epsilon_n = -4 * t * np.cos(n * np.pi / (N+1)) * np.cos(phi)
# Plot the energy dispersion
plt.figure(figsize=(8, 6))
plt.plot(n, epsilon_n, label=r'$\epsilon_n = -4t \cos(\frac{n\pi}{N+1}) \cos(\phi)$')
plt.title("Energy Dispersion in Tight-Binding Chain with Peierls Substitution")
plt.xlabel("Mode index (n)")
plt.ylabel("Energy ($\epsilon_n$)")
plt.grid(True)
plt.legend()
plt.show()
aW1wb3J0IG51bXB5IGFzIG5wCmltcG9ydCBtYXRwbG90bGliLnB5cGxvdCBhcyBwbHQKCiMgRGVmaW5lIHRoZSBwYXJhbWV0ZXJzCnQgPSAxLjAgICMgSG9wcGluZyBhbXBsaXR1ZGUKTiA9IDUwICAgIyBOdW1iZXIgb2YgbGF0dGljZSBzaXRlcwpwaGkgPSBucC5waSAvIDQgICMgUGhhc2UgZmFjdG9yIChleGFtcGxlOiBwaS80KQoKIyBHZW5lcmF0ZSB0aGUgbW9kZSBpbmRpY2VzICgxIHRvIE4pCm4gPSBucC5hcmFuZ2UoMSwgTisxKQoKIyBDYWxjdWxhdGUgdGhlIGVuZXJneSBkaXNwZXJzaW9uIGZvciBlYWNoIG1vZGUgbgplcHNpbG9uX24gPSAtNCAqIHQgKiBucC5jb3MobiAqIG5wLnBpIC8gKE4rMSkpICogbnAuY29zKHBoaSkKCiMgUGxvdCB0aGUgZW5lcmd5IGRpc3BlcnNpb24KcGx0LmZpZ3VyZShmaWdzaXplPSg4LCA2KSkKcGx0LnBsb3QobiwgZXBzaWxvbl9uLCBsYWJlbD1yJyRcZXBzaWxvbl9uID0gLTR0IFxjb3MoXGZyYWN7blxwaX17TisxfSkgXGNvcyhccGhpKSQnKQpwbHQudGl0bGUoIkVuZXJneSBEaXNwZXJzaW9uIGluIFRpZ2h0LUJpbmRpbmcgQ2hhaW4gd2l0aCBQZWllcmxzIFN1YnN0aXR1dGlvbiIpCnBsdC54bGFiZWwoIk1vZGUgaW5kZXggKG4pIikKcGx0LnlsYWJlbCgiRW5lcmd5ICgkXGVwc2lsb25fbiQpIikKcGx0LmdyaWQoVHJ1ZSkKcGx0LmxlZ2VuZCgpCnBsdC5zaG93KCkK