I'm using Polynomial from numpy to calculate a best fit line like this:
from numpy.polynomial import Polynomial
...
# get best-fit polynomial for values
best_fit_polynomial = Polynomial.fit(x_points, y_points, 4)
The graph of the values looks like this:
How do I find the area between the best fit line in orange and say a horizontal line at Y=70?
Going off of this I'm guessing I need to do something like:
i = best_fit_polynomial.integ()
first = i(best_fit_polynomial_where_Y_is_70_on_the_left)
second = i(best_fit_polynomial_where_Y_is_70_on_the_right)
return second - first
I'm having trouble remembering any calculus at all so I'm not sure if I'm even heading in the right direction. Should I be using something instead of numpy?