I need to create simple program which will take every element of list and put it in polyfit polynomial,then calculate it.
Here is my code
import pylab as p
import numpy as np
import sympy as s
from random import random
X=np.arange(0,1000)
y=np.random.randint(100,size=1000)
if len(X)==len(y):
print "ok"
else:
print "not ok"
polyfit=np.polyfit(X,y,3)
poly1d=np.poly1d(polyfit)
print poly1d
i=1
my=[]
for i in X:
p=poly1d[i]
my.append(p)
Y=my
print Y
My problem is that this only rewrite coefficient of polynomial and rest elements from list are 0.I need a clue how to solve it properly.