# Contour plot and infinite/indeterminate expressions encountered

I need to plot this implicit equation $$\omega-k=\frac{1}{k}\left[1+\left(1-\frac{\omega}{k}\right) \frac{1}{2} \ln \left(\frac{\omega+k}{\omega-k}\right)\right]\,,$$

for $$(k,\omega)\in[0,5]\times[0,5]$$. Theoretically, the result is finite at $$k=0$$ (in fact, the limit is $$\omega=1$$) and WolframAlpha confirms it.

I tried the following piece of code,

w[k_, \[Omega]_] :=
1/k (1 + (1 - \[Omega]/k) 1/2 Log[(\[Omega] + k)/(\[Omega] - k)]);
ContourPlot[{\[Omega] - k == w[k, \[Omega]]}, {k, 0,
5}, {\[Omega], 0, 5}]


but I get the following error messages:

and an empty plot. What can I do to overcome this issue?

• It is not the limit that cause the issue. Check that for $k=\omega=x$ you have $\log\left(\frac{x+x}{x-x}\right)$
– bmf
Commented Apr 11, 2022 at 19:39
• Thanks, @bmf, but as far as I understand, $k=\omega$ is not a solution to the implicit equation. I might be wrong, though. Commented Apr 11, 2022 at 19:42

Clear["Global*"]

w[k_, ω_] := 1/k (1 + (1 - ω/k) 1/2 Log[(ω + k)/(ω - k)]);

Limit[w[k, ω], #] & /@ {ω -> k, k -> 0, ω -> 0}

(* {1/k, 1/ω, (2 + I π)/(2 k)} *)

w[k_, k_] := 1/k;

w[_?(# == 0 &), ω_] := 1/ω;

w[k_, _?(# == 0 &)] := (2 + I*Pi)/(2 k)

ContourPlot[{ω - k == w[k, ω]}, {k, 0, 5}, {ω, 0, 5},
Exclusions -> {ω == k},
FrameLabel -> (Style[#, 16] & /@ {k, ω})]
`

• Thanks! Now I understand what I was missing. Commented Apr 11, 2022 at 20:32