Method 1
You can reverse the value of {x,y}
to {y,x}
, and then interpolate them.
Note:In this case, the value of $y$ cannot be duplicate
lst=
{{3.61648, 5.64818}, {7.53428, 4.52803}, {4.21088, 2.35117},
{4.48224,1.08325}, {4.63735, 5.5877}, {2.24299, 3.10376}}
x = Interpolation[Reverse /@ data];
x[3.]
2.44086
Method 2
If the the values of $y$ are be duplicate, you should interpolate in two directions.
For instance, using the following method
Options[interpolateCurve] =
Join[Options[ParametricPlot3D], Options[Interpolation]];
interpolateCurve[pts : {{_, _} ..}, opts : OptionsPattern[]] :=
Module[{order, x, y, s, func1, func2},
order = OptionValue[InterpolationOrder];
x = pts[[All, 1]];
y = pts[[All, 2]];
(*calculate the accumulative chord length*)
s =
FoldList[
Plus, 0, EuclideanDistance @@@ Partition[pts, 2, 1]];
(*interpolation points with spline-method in two directions*)
{func1, func2} =
Interpolation[
Thread@{s, #}, InterpolationOrder -> order, Method -> "Spline"] & /@ {x, y};
(*visualize the curve*)
ParametricPlot[{func1[t], func2[t]}, {t, 0, Last[s]},
Evaluate@
(Sequence @@ FilterRules[{opts}, Options[ParametricPlot]]),
Epilog -> {Red, PointSize[Medium], Point[pts]}]
]
InverseFunction[y]
. $\endgroup$InverseFunction[y][y0]
, it does not work. I know it is a bit trivial, but maybe has to do with the fact it is an interpolation. $\endgroup$