I currently have this code:
import numpy as np
def mapfeature_binominal_array(x1,x2,n=6,list=[]):
if len(list)==0:
list.append(x1)
list.append(x2)
if n==1:
print(np.array(list))
return np.array(list)
else:
for i in range(0,n+1):
formula=((x1)**(n-i))*((x2)**(i))
list.append(formula)
mapfeature_binominal_array(x1,x2,n-1,list)
test_array=mapfeature_binominal_array(-0.25,1.5)
which prints out the following output:
[ -2.50000000e-01 1.50000000e+00 2.44140625e-04 -1.46484375e-03
8.78906250e-03 -5.27343750e-02 3.16406250e-01 -1.89843750e+00
1.13906250e+01 -9.76562500e-04 5.85937500e-03 -3.51562500e-02
2.10937500e-01 -1.26562500e+00 7.59375000e+00 3.90625000e-03
-2.34375000e-02 1.40625000e-01 -8.43750000e-01 5.06250000e+00
-1.56250000e-02 9.37500000e-02 -5.62500000e-01 3.37500000e+00
6.25000000e-02 -3.75000000e-01 2.25000000e+00]
However, when i try:
print(test_array)
I get None
.
I am wondering why it does not assign the array to test_array
.