Ok, so while practicing python, plotting and quadratic equations - I found this weird behaviour in plotting.
The function 'func' defines one of the solution to a quadratic equation. The solution being 0.5(x+1 - sqrt((x+1)^2 - 4x))
And so I tried plotting this value against different x values. I get something similar to this -> Click Here
A friend pointed out that the solution actually reduces to 1.0 - therefore the plot should be a horizontal line passing through y at 1.0
Obviously that is not what I'm getting.
Can someone please explain why I'm getting a weird plot? Thanks in advance! :)
import matplotlib.pyplot as plt from math import * def func(x): B = x + 1.0 C = x y = 0.5 * (B - sqrt(B ** 2 - 4 * C)) return y def frange(start, stop, step): i = start while i < stop: yield i i += step x =  y =  for i in frange(0.0, 2.0, 0.01): x.append(i) y.append(func(i)) plt.scatter(x, y) plt.show()