Program in Numpy (Python) that takes in five points from a graph and returns the coefficients for the function of that graph
I want to create a program in Numpy (Python) that takes in five points from a graph and returns the coefficients for the function of that graph. Mathematically it would be like this:
PS: I know this question is a lot so even if you can't completely answer it I understand but I would appreciate a tip or at least the name of a NumPy library that could help me do this and I'll research it.
From that, I just want to know how to implement it into NumPy. Please help!
I know I have to subtract the polynomials so I have this:
def find_conic():
# define the polynomials
# p(x) = 5(x**2) + (-2)x +5
px = (5,-2,5)
# q(x) = 2(x**2) + (-5)x +2
qx = (2,-5,2)
# subtract the polynomials
rx = np.polynomial.polynomial.polysub(px,qx)
# print the resultant polynomial
print(rx)
find_conic()
I would then have to substitute the subtracted equation into each other to get the equation for a for example.
source https://stackoverflow.com/questions/70160614/program-in-numpy-python-that-takes-in-five-points-from-a-graph-and-returns-the
Comments
Post a Comment