-5

I want to compute the band structure of some model. First,I have to get the eigenvalues, and the eigenvectors by diagonalizing the 3*3 matrix. I dont know what mistakes I've done. Error message File "", line 12 for n in range((-L/(2.0)), (L/(2.0)): ^ IndentationError: unexpected indent

enter image description here

E.K
  • 9
  • 3
  • your `for` loop is indented when it shouldn't be, as the error message states. What more info do you need? – Zinki Jul 04 '18 at 08:21
  • Please, paste code as code (formatted text) not as a picture. – Ondrej K. Jul 04 '18 at 08:24
  • Possible duplicate of [I'm getting an IndentationError. How do I fix it?](https://stackoverflow.com/questions/45621722/im-getting-an-indentationerror-how-do-i-fix-it) – L_Church Jul 04 '18 at 08:25

2 Answers2

0

As noted in the comments the for statement itself should not be indented. There is also an additional problem the for statement should end with a ':' not a ';'.

Paula Thomas
  • 1,152
  • 1
  • 8
  • 13
0
import numpy as np
import scipy.linalg as la
from math import *
import matplotlib.pyplot as plt
L=20.0 #length of the chain
k= 2.0*pi*n/L
M = np.array([[-2*t*cos(k), -t, 0.0], [-t, -2*t*cos(k), -t], [0.0, -t, -2*t*cos(k)]])
for n in range((-L/(2.0)), (L/(2.0))
u, V = la.eig(M)
print(u)
print np.real_if_close(u)
E.K
  • 9
  • 3