Finding the intersect between a quadratic and a line

333 Views Asked by At

I am trying to find the intersect between a straight line and a quadratic curve, however the result I am getting appears to be imaginary although I don't see how this can be the case as I can see them intersect on real axes:

Import numpy
#quadratic coefficients



a,b,c = (-3.09363812e-04, 1.52138019e+03, -1.87044961e+09)

# y = ax^2 + bx + c



#line coefficients

m,d = (1.06446434e-03, -2.61660911e+03)

#y = mx + d



intersect = (-(b-m)+((b-m)**2 - 4*a*(c-d))**0.5)/(2*a)

print(intersect)

The output of this is 2458883.4674943495-107.95731226786134j

I am trying to find the intersect between the yellow curve over the blue points and the black dotted line

enter image description here

1

There are 1 best solutions below

2
On

Here's the correct graphs of the parabola and line described in the question. Definitely different from those shown above. As you can see, line and parabola do not intersect.

enter image description here