I have got an array of points, which can be represented as a ListLinePlot. Then I am trying to find the number of intersections of this ListLinePlot with a certain line. Obviously, in the demonstrated case the number of intersections should be two, but I get 5 points as a result. RegionIntersection gives the same result. How can I fix that? I can't create and solve the system of equations, representing an intersection condition, because there is a large number of arrays to be investigated and their general appearance is unknown. The problem is that I should know the exact number of intersections. Thanks in advance.
My code is (sol is an above-mentioned array of points):
lst1 = Sort[sol];
lst2 = Table[{x, Max[Sort[sol[[All, 2]]]] - (Max[Sort[sol[[All, 2]]]] - Min[Sort[sol[[All, 2]]]])/5},
{x, Min[Sort[sol[[All, 1]]]], Max[Sort[sol[[All, 1]]]], 0.5}];
plot = ListLinePlot[{lst1, lst2}, PlotRange -> All]
l = Graphics`Mesh`FindIntersections@plot
The concrete example of the "sol" array:
{{7.05547, -2.46723}, {1.86965,
1.1145}, {5.99004, -0.731189}, {3.12849,
1.61209}, {7.16644, -2.67133}, {1.74237,
0.984025}, {7.02438, -2.41082}, {1.90557, 1.1482}, {5.23746,
0.238673}, {3.98266, 1.32496}, {6.38239, -1.32259}, {2.66365,
1.57629}, {7.25692, -2.84091}, {1.63982,
0.865836}, {7.27641, -2.87781}, {1.61788,
0.838986}, {7.27742, -2.87971}, {1.61675,
0.83759}, {7.27695, -2.87882}, {1.61728,
0.838239}, {7.27717, -2.87925}, {1.61703,
0.837928}, {7.27707, -2.87905}, {1.61714,
0.838075}, {7.27712, -2.87914}, {1.61709,
0.838006}, {7.27709, -2.8791}, {1.61711,
0.838039}, {7.2771, -2.87912}, {1.6171,
0.838023}, {7.2771, -2.87911}, {1.61711,
0.83803}, {7.2771, -2.87911}, {1.6171,
0.838027}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711,
0.838028}, {7.2771, -2.87911}, {1.61711, 0.838028}}