I want to find the number of intersection points, but my code works only if all a, b, c numbers are equal e.g. if i change a2 to 0, and c2 to 2, it should print 2, but it prints 0. Can you spot the mistake?
import matplotlib.pyplot as plt
import math as m
import numpy as np
a1 = 1
b1 = 1
c1 = 1
a2 = 1
b2 = 1
c2 = 1
x1 = np.arange(-10, 10, 0.1)
y1 = []
y2 = []
sum = 0
for x in x1:
y1.append(a1 * m.pow(x, 2) + b1 * x + c1)
y2.append(a2 * m.pow(x, 2) + b2 * x + c2)
if (a1 - a2) * m.pow(x, 2) + (b1 - b2) * x + c1 - c2 == 0:
sum += 1
print(sum)
plt.plot(x1, y1)
plt.plot(x1, y2)
plt.grid(True)
plt.show()