user765443
user765443

Reputation: 1892

create quadratic equation using Python library

I have data point on which I need to create quadratic equation.Do we have any python module which create quadratic equation.I have manual approach which is mentioned into below link. but I feel it can be in better in Python.In below example, They have taken 3 point but In my case it will varies as per the user input

http://www.algebra.com/algebra/homework/quadratic/Quadratic_Equations.faq.question.192159.html

Upvotes: 1

Views: 972

Answers (1)

wwii
wwii

Reputation: 23743

have a look at http://www.numpy.org/

>>> import numpy as np
>>> A, B, C = np.polyfit([1,2,3],[4,7,12],2)
>>> print A, B, C
1.0 -4.2727620148e-15 3.0
>>> print A, 'x^2 +', B, 'x +', C
1.0 x^2 + -4.2727620148e-15 x + 3.0
>>>

Upvotes: 1

Related Questions