I would like to have the intersection points of two lines in python using numpy. I wrote a piece of code but I can not complete the code. I have a curve of 1000 points which has been read by numpy and plotted by matplotlib. Also, I plotted the line y=0 and Currently, I want to have the number of intersections that the first curve has with the line y = 0. like the figure below
The code is below:
import matplotlib.pyplot as plt
import numpy as np
#ll = np.linspace(min(x),max(x),1696)
with open('file1.txt', 'r') as f:
lines = f.readlines()
x = [float(line.split()[0]) for line in lines]
y = [float(line.split()[1]) for line in lines]
a = np.array(y)
b = np.where (y==0)
print(b)
All favors will be appreciated.