I have such Python code
import numpy as np
import matplotlib.pyplot as plt
import math
from scipy import optimize as opt
def func1(x):
f1 = math.exp(x-2)+x**3-x
return f1
solv1_bisect = opt.bisect(func1, -1.5, 1.5)
x1 = np.linspace(-1.5,1.5)
y1 = func1(x1)
plt.plot(x1,y1,'r-')
plt.grid()
print('solv1_bisect = ', solv1_bisect)
and I've got the error message such as
TypeError: only length-1 arrays can be converted to Python scalars
Please help me to fix it, Thanks!