# Find zeros of function in 2 variables

I have two functions f(r,ϕ)f(r,ϕ)f(r,\phi), and g(r,ϕ)g(r,ϕ)g(r,\phi).

What is the best way to find the curve in the plane (x,y)(x,y) or (r,ϕ)(r,\phi), over which f(r,ϕ)=g(r,ϕ)f(r,\phi)=g(r,\phi)?

I know how to plot it, using ContourPlot, but it seems that both Solve and FindRoot aren’t suited to solve my problem. Any help?

Edit

My functions are:

Q00=1; a=1; k=0.01;

dQ1[r_, Ï•_] = Q00/2 (BesselK[0, k r]/BesselK[0, k a] + BesselK[1, k r]/BesselK[1, k a] Cos[Ï•]);

f[r_, Ï•_] := -(Q00/2) + dQ1[r, Ï•];
g[r_, Ï•_] = Q00 /2 Sin[Ï•] (a/r);

The range I am interested in is a x, Infinity], 1]][ x], {x, -1, 3}]
– Dr. belisarius
Nov 19 ’15 at 15:40

With knowing the exact form of the functions it is easier to helping you. but you can try numberic solving. other form of those functions if be exist and so on.
– jack cilba
Nov 19 ’15 at 15:45

I edited the question, maybe you could expand on that, thanks!
– usumdelphini
Nov 19 ’15 at 15:48

one of the functions is x^2 – x y == x^2 + y^2 – 1 what is another function? @usumdelphini
– jack cilba
Nov 19 ’15 at 15:53

That is not my function, my functions are in the question, not in the comments.
– usumdelphini
Nov 19 ’15 at 15:54

=================

3

=================

maybe this give you some Idea :

Plot[Evaluate@
Table[Evaluate[f[x, y] /. {a -> 2, k -> 3}] –
Evaluate[g[x, y] /. {a -> 4}], {y, 1, 10}], {x, 0.01, 10}]

at least we can guess that for 0 {0}, ContourShading -> None];
fun = Cases[cp, Line[x__] :> x, -1];
pts = cp[[1, 1]];
t = pts[[fun[[1]]]];
{xd, yd} = Transpose[t];
xf = ListInterpolation[xd, {0, 1}]
yf = ListInterpolation[yd, {0, 1}]

You can recover for range 0 to 2π2 \pi:

pp = ParametricPlot[Mod[{xf[t], yf[t]}, 2 Pi], {t, 0, 1},
Frame -> True, PlotRange -> {{0, 10}, {0, 2 Pi}},
AspectRatio -> Automatic]
Row[{pp, ContourPlot[f[x, y] – g[x, y], {x, 0, 10}, {y, 0, 2 Pi},
Contours -> {0}, ContourShading -> None,
AspectRatio -> Automatic]}]

Confirming (on −π-\pi to π\pi range for convenience):

h[t_] := {xf[t], yf[t]};
p1 = Plot3D[{f[x, y], g[x, y]}, {x, 0, 10}, {y, -Pi, Pi},
Mesh -> False];
p2 = ParametricPlot3D[{xf[t], yf[t], f @@ h[t]}, {t, 0, 1},
PlotStyle -> {Red, Thickness[0.02]}];
Show[p1, p2]

Looking at ContourPlot, we should be able to get an idea of where the roots are:

ContourPlot[
f[r, \[Phi]] == g[r, \[Phi]], {r, 1, 10}, {\[Phi], 0, 2 Pi}]

We can then use With and Table to get the roots.

In[16]:= Table[
With[{r = r1},
FindRoot[f[r, \[Phi]] == g[r, \[Phi]], {\[Phi], 0.5}]], {r1, 1, 4,
0.5}]

Out[16]= {{\[Phi] -> 0.785398}, {\[Phi] -> 0.694063}, {\[Phi] ->
0.575969}, {\[Phi] -> 0.434701}, {\[Phi] -> 0.268362}, {\[Phi] ->
0.0677875}, {\[Phi] -> -0.196409}}