0
Good afternoon. I made a small algorithm on Python
, appeared the following error:
Typeerror: only length-1 arrays can be converted to Python scalars.
Someone could help me. Follow the code.
import numpy as np
import math
x=np.ones((3,1))
y=np.ones((3,1))
err=[]
for k in range(3,15):
x=np.append(x,1.074*((x[k-1])**2)-2.042*x[k-2]*x[k-3])
y=np.append(y,1.074*y[k-1]*y[k-1]-2.042*y[k-2]*y[k-3])
err.append(math.fabs((x-y)/2))