# Solving equation involving 2D interpolated function

I have this data making this ListPlot3D:

ListPlot3D[Flatten[trialstuff2, 1], ColorFunction -> "TemperatureMap"]


I can create an interpolation function:

intFunc = Interpolation[Join @@ trialstuff2];


I want to find the solutions to the equation intFunc == 0  as a y[x] function since it will be in 2D.

How can I do it?
I could not get Solve to work. Is there a trick to it or do I need to find the intersection between the interpolated function and a plane {x,y,0}?

• Sorry I cannot load the data trialstuff. Could you please provide a small set of data? Thanks. Jun 12 '18 at 13:05
• @UlrichNeumann I managed to import the data by changing the file extension from .txt to .m and than using just the Import function. Jun 12 '18 at 13:08
• @Fraccalo: Thank you for your effort, but I cannot access the link(url)... Jun 12 '18 at 13:27

Try:

f0[x_] = NSolve[intFunc[x, y] == 0, y][[1]]


In this way you will obtain a function y[x] where the intFunc[x,y]==0.

For example:

(intFunc[#, y /. f0[#]]) & /@ Range[2.5, 4, 0.1] // Chop


{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

pp0 = {#, y /. f0[#], (intFunc[#, y /. f0[#]])} & /@ Range[2.5, 4, 0.01] // Chop;
Show[
ListPlot3D[Flatten[trialstuff2, 1], ColorFunction -> "TemperatureMap"]
, ListPointPlot3D[pp0]
]


And this is for showing that the intersection is actually in z=0:

Show[
ListPlot3D[Flatten[trialstuff2, 1], ColorFunction -> "TemperatureMap"]
, Plot3D[0, {x, 0, 5}, {y, 0, 500}, PlotStyle -> Opacity[0.5]]
, ListPointPlot3D[pp0]
]


• No it still gives no answer Jun 12 '18 at 12:58
• @Fraccalo, not sure I understand what you propose. Why should you solve for $y$ only, instead of for $x$ and $y$? Jun 12 '18 at 13:06
• @MarcoB I think I misinterpreted the question. I thought the OP was about finding y[x] so that the intFunc is equal to 0. And I thought my solution provided that. For example, if we consider the toy case: a[x_] = Solve[x + y == 0, y] the result gives {{y -> -x}}, which is a y[x] that satisfies the condition of x+y ==0! Jun 12 '18 at 13:16
• I'll edit the answer to make that clearer. Jun 12 '18 at 13:30