I am working on functions and i practice it by some codes (there is a bias because i am working on neural networks) and when i was doing square root function and i got an error:
TypeError: only size-1 arrays can be converted to Python scalars
Here is the code which caused it.
import matplotlib.pyplot as plt
import numpy as np
import math
def somefunc(m,bias):
y = round(math.sqrt(m))+ bias
return y
y = np.linspace(1, 100, 100)
z = somefunc(y,0)
plt.plot(y, z)
plt.xlabel("y")
plt.ylabel("func(y)")
plt.show()