I want to plot a function and each time I got this error: only size-1 arrays can be converted to Python scalars. I want to plot my function over the w.
The code is :
import matplotlib.pyplot as plt
import numpy as np
import math
a = 10;
w = np.arange (0.001,10, 0.1)
function = (1/(np.pi*(w**2))+ np.pi)*abs(((-2*math.atan(a))*w)-(2*math.atanh(((w**2) + 1)/(-1*(w**2) + 2*(a**2) +1))*w)+ (np.pi*w) -(2*math.atanh(w/(a))))
plt.plot(w, function)
plt.show()
Thanks for your time.
