5BLD
Legend
Sorry i haven't been able to reply, I'm still busy but I'd just like to point out your polynomial won't be that big, itll only be of order 4. Also try using infinity as one of the points.
Here's what I've cooked up.
Here's what I've cooked up.
a=1
b=2
c=3
d=4
e=5
f=6
def p1(x):
return a*x**2+b*x+c
def p2(x):
return d*x**2+e*x+f
#the huge polynomial will have coefs j,k,l,m,n
#points = [-2,-1,0,1,2]
product-2 = p1(-2)*p2(-2)
product-1 = p1(-1)*p2(-1)
product0 = p1(0)*p2(0)
product1 = p1(1)*p2(1)
product2 = p1(2)*p2(2)
now these products will be put into a matrix. then determinant is worked out then ill multiply it through to work out the huge polynomial.
I don't care anymore whether it's more efficient than naive this way now, because I suppose I can work out a better interpolation method in time.
edit: determinant of a 5x5 matrix. jeez um...
though it's good the determinant is being calculated beforehand.
edit2:
the determinant is 288.
this is the inverse matrix supposedly
0.042 -0.167 0.250 -0.167 0.042
-0.083 0.167 0.000 -0.167 0.083
-0.042 0.667 -1.250 0.667 -0.042
0.083 -0.667 0.000 0.667 -0.083
0.000 0.000 1.000 0.000 0.000
b=2
c=3
d=4
e=5
f=6
def p1(x):
return a*x**2+b*x+c
def p2(x):
return d*x**2+e*x+f
#the huge polynomial will have coefs j,k,l,m,n
#points = [-2,-1,0,1,2]
product-2 = p1(-2)*p2(-2)
product-1 = p1(-1)*p2(-1)
product0 = p1(0)*p2(0)
product1 = p1(1)*p2(1)
product2 = p1(2)*p2(2)
now these products will be put into a matrix. then determinant is worked out then ill multiply it through to work out the huge polynomial.
I don't care anymore whether it's more efficient than naive this way now, because I suppose I can work out a better interpolation method in time.
edit: determinant of a 5x5 matrix. jeez um...
though it's good the determinant is being calculated beforehand.
edit2:
the determinant is 288.
this is the inverse matrix supposedly
0.042 -0.167 0.250 -0.167 0.042
-0.083 0.167 0.000 -0.167 0.083
-0.042 0.667 -1.250 0.667 -0.042
0.083 -0.667 0.000 0.667 -0.083
0.000 0.000 1.000 0.000 0.000
Last edited: