I'm trying to solve the following numerical problem:
I have a function of 2 variables in some rectangular region, the function is computed numerically with some moderate time cost (solution of linear differential equation with those variables as parameters, though it is not important here).
Let's assume here without loss of generality that the function is
f[x_,y_] = (Sin[x] Sin[5 y]/y - 0.3)^2
for 0<x<Pi/2, -2<y<2
I'm trying to obtain efficient numerically (heavy cost of calling function) and transparent way to finding 2d curves for which this function is 0.
To exemplify, I can obtain such curves by calling ContourPlot
ContourPlot[f[x,y], {x, 0, Pi/2}, {y, -2, 2}, ContourShading -> None, Contours -> {0.01}]
Mind that for every minimum reaching 0 there are 2 lines because I had to use nonzero contour value, and also because of precision some contours aren't fully found.
Taking specific choice for this example, let's say I want on some sections find y = g[x], which I tried to do by finding zeros for slice of function f for given x.
In other words I have plot like this for some given x

And I want to find all zeros.
In theory it should be easy, but I had problems using with NMinimize and FindRoot (although maybe solution lies with them). Solution like this (namely reintegrating function) is out of question due to high computational cost.
When in given slice there are multiple roots, I assume I will be able to classify them by hand (as in this example), but I need a method to find them all or find specific one that is continuous across different slices.


