# How to find the intersection line from plotting data of 2 groups and How to solve it (e.g. remove or delete it) [closed]

I have 2 group of data points,

herewith is group A

dataA= {{86.0365, 38.6844}, {86.0526, 38.6998}, {86.069, 38.7154}, {86.085, 38.7308}, {86.1087, 38.7534}, {86.1332, 38.7766}, {86.1491, 38.7918}, {86.1651, 38.8068}, {86.1976, 38.8378}, {86.2377, 38.8758}, {86.2779, 38.9136}, {86.2942, 38.9289}, {86.3347, 38.9672}, {86.359, 38.99}, {86.3834, 39.0129}, {86.3996, 39.0281}, {86.4157, 39.0432}, {86.432, 39.0585}, {86.4562, 39.0812}, {86.4723, 39.0963}, {86.4968, 39.1191}, {86.5211, 39.1418}, {86.5534, 39.1719}, {86.5781, 39.1947}, {86.6104, 39.2249}, {86.6347, 39.2472}, {86.668, 39.278}, {86.6841, 39.2931},
{86.7082, 39.3152}, {86.7248, 39.3306}, {86.741, 39.3455}, {86.7573, 39.3605}, {86.7736, 39.3756}, {86.7898, 39.3904}, {86.8066, 39.4058}, {86.8229, 39.4209}, {86.839, 39.4357}, {86.8554, 39.4506}, {86.872, 39.4658}, {86.8965, 39.4882}, {86.9126, 39.503}, {86.9294, 39.5183}, {86.9456, 39.5332}, {86.962, 39.5481}, {86.9784, 39.5631}, {86.9945, 39.5776}, {87.012, 39.5936}, {87.0259, 39.6062}, {87.0506, 39.6289}, {87.0446, 39.6248}, {86.9309, 39.6007}, {86.9319, 39.6008}, {87.1508, 39.7224}, {87.3654, 39.9241}, {87.5335, 40.0905}, {87.7128, 40.2768},
{87.884, 40.4632}, {88.0522, 40.6547}, {88.2157, 40.8498}, {88.3747, 41.0487}, {88.5293, 41.2511}, {88.6793, 41.4572}, {88.8248, 41.6666}, {88.9656, 41.8794}, {89.1018, 42.0955}, {89.2334, 42.3148}, {89.3602, 42.5372}, {89.4823, 42.7625}, {89.5998, 42.9908}, {89.7124, 43.2221}, {89.8204, 43.4563}, {89.9238, 43.6932}
}


And herewith is group B

dataB= {{94.6467, 45.3748}, {94.2518, 45.1257}, {93.8591, 44.8731}, {93.4686, 44.6171}, {93.0804, 44.3577}, {92.6944, 44.0949}, {92.3108, 43.8287}, {91.9295, 43.5593}, {91.5506, 43.2865}, {91.174, 43.0104}, {90.7999, 42.731}, {90.4282, 42.4484}, {90.059, 42.1625}, {89.6924, 41.8734}, {89.3282, 41.5812}, {88.9666, 41.2858}, {88.6076, 40.9872}, {88.2513, 40.6855}, {87.8976, 40.3807}, {87.5465, 40.0729}, {87.1982, 39.762}, {86.8525, 39.448}, {86.5097, 39.1311}, {86.1696, 38.8112}
}


I plotted both of groups point data in Mathematica.

How to find the intersection line from plotting data above using mathematica programming and How to solve it (e.g. remove or delete it).

## 1 Answer

My answer is that:

What you are asking does not make much sense for that given set of data.

Your data does not describe a function, as around x->87 there is more than one Ordinate

ListPlot[
dataA
, PlotRange -> {{86.8, 87.2}, {39, 40}}
, Joined -> True
,  Mesh -> All
]


Even if you were to fix that deleting the offending data points, for example

Delete[dataA, {{50}, {51}, {52}}]


The two data sets seems approach asymptotically

ListPlot[
{
Delete[dataA, {{50}, {51}, {52}}]
, dataB
}
, PlotRange -> {{All, 88}, {38, 41}}
, Joined -> True
, Mesh -> All
]


Plotting the difference of a linear Interpolation suggest three solutions, that is, if you don't considered this features just noise.

Plot[
Interpolation[Delete[dataA, {{50}, {51}, {52}}],
InterpolationOrder -> 1][x]
- Interpolation[dataB, InterpolationOrder -> 1][x]
, {x, 86.17, 87}
]


Solutions can be fond using FindRoot

FindRoot[
Interpolation[Delete[dataA, {{50}, {51}, {52}}],
InterpolationOrder -> 1][x]
- Interpolation[dataB, InterpolationOrder -> 1][x]
, {x, 87}
]

{x -> 86.86}


But beware that these are heavily dependent of the InterpolationOrder, so the values are just an artefact, and I think you can not define a intersection for that set of data.

FindRoot[
Interpolation[Delete[dataA, {{50}, {51}, {52}}],
InterpolationOrder -> 2][x]
- Interpolation[dataB, InterpolationOrder -> 2][x]
, {x, 87}
]

{x -> 87.0026}

Plot[
Interpolation[Delete[dataA, {{50}, {51}, {52}}],
InterpolationOrder -> 2][x]
- Interpolation[dataB, InterpolationOrder -> 2][x]
, {x, 86.17, 87}
]