# How can we extract the points of a level-set from a 2D Interpolating function? [duplicate]

Let us assume that we have a 2D Interpolating function u[x,y]. We can plot its contours by

ContourPlot[u[x,y],{x,xmin,xmax},{y,ymin,ymax}]

But how for given u0 can we extract all points x0,y0 such that u[x0,y0]=u0 in a table form?

• I'd say the fact that it's an interpolating function doesn't change anything, you should be able to use the methods here: mathematica.stackexchange.com/q/105750/9490 Jan 18 '17 at 15:29
• This may be even more directly what you want. Or this Jan 18 '17 at 15:30
• Thank you for your answers. But my main concern is how to get the values x0,y0 !
– DK13
Jan 18 '17 at 15:58
• Show an MWE illustrating your issue. With such general statements it's not clear what do you really want. In my opinion, the posted links adresse your issue and provide additional hints allowing to fulfill your needs. If not, then I'm mistaken because your question isn't clear enough. Jan 18 '17 at 16:01
• @DK13 - look at either of the answers from my second comment, and they say exactly how to get those values. Jan 18 '17 at 16:07

u[x_, y_] := x + y
int = Interpolation @ Catenate @ Table[{{x, y}, u[x, y]}, {x, 0, 1, 0.1}, {y, 0, 1, 0.1}];
u0 = 0.5;
plot = ContourPlot[int[x, y] == u0, {x, 0, 1}, {y, 0, 1}] Investigating

FullForm[plot]


pts = Cases[plot, _GraphicsComplex, Infinity][[1, 1]];

ListPlot[pts, PlotRange -> {{0, 1}, {0, 1}}, Frame -> True, AspectRatio -> 1] The above extracts the deafult number of points used by ContourPlot. To extract more points, add PlotPoints -> 100 (or any other suitable number) as an option to ContourPlot.

• thank you! How can we get denser or less denser points?
– DK13
Jan 18 '17 at 17:38
• Or to homogenize the distance between the various points?
– DK13
Jan 18 '17 at 17:54