I have this code but can't run it, can anyone help me fix it?
import numpy as np
from numpy import pi, sin
import math
import matplotlib.pyplot as plt
%matplotlib inline
import scipy.linalg as lg
def V(x, k):
return 0.5 * k * x**2
N = 500
x = np.linspace(-10, 10, N)
dx = x[1] - x[0]
V_matrix = np.matrix(np.diag(V(x, k)))
K_matrix = (-1/2 * np.matrix(np.eye(N, k=-1)) + np.matrix(np.eye(N, k=1)) - 2 * np.matrix(np.eye(N)) / dx**2)
eigen_energies, eigen_modes = lg.eigh(K_matrix + V_matrix)
eigen_modes = eigen_modes.T
plt.figure(figsize=(8, 8))
plt.plot(x, V(x, k))
plt.show()
np.std([2, 3, 4])