1
$\begingroup$

I would like to plot in the complex plane the solutions of the equation $$e^{-z}=z.$$

I tried this: I took $z=a+ib$ and took the real and imaginary part of the equation:

ContourPlot[{a == E^-a Cos[-b], b == E^-a Sin[-b]}, {a, -10, 5}, {b, -10, 10}] 

enter image description here

So the intersections of the curves are the solutions to the equation (we notice there's only one real solution).

I have two questions:

  1. Is there a way to plot the solutions of the equation by showing only the solutions as dots (without showing the curves)?

  2. Is there a way to do this just by plugging directly the complex equation $e^{-z}=z$ without translating it to real and imaginary parts?

$\endgroup$

3 Answers 3

3
$\begingroup$

We can use MeshFunction in ComplexContourPlot.

Clear[f]; f[z_] = Exp[-z] - z; ComplexContourPlot[{Re[f[z]] == 0}, {z, -20 - 20 I, 20 + 20 I}, MeshFunctions -> {Im[f[#]] &}, Mesh -> {{{0}}}, MeshStyle -> Directive[{PointSize[Large], Red}], ContourStyle -> None] 

enter image description here

Clear[f, fig1, fig2]; f[z_] = Exp[-z] - z; fig1 = ComplexContourPlot[{Re[f[z]] == 0}, {z, -20 - 20 I, 20 + 20 I}, MeshFunctions -> {Im[f[#]] &}, Mesh -> {{{0}}}, MeshStyle -> Directive[{PointSize[Large], Red}], ContourStyle -> Brown]; fig2 = ComplexContourPlot[{Im[f[z]] == 0}, {z, -20 - 20 I, 20 + 20 I}, MeshFunctions -> {Re[f[#]] &}, Mesh -> {{{0}}}, MeshStyle -> Directive[{PointSize[Large], Red}], ContourStyle -> Cyan]; Show[fig1, fig2] 

enter image description here

Compare with the approach which use NSolve.

roots = NSolve[{Exp[-z] - z == 0, -20 <= Re[z] <= 20, -20 <= Im[z] <= 20}]; ListPlot[ReIm[z] /. roots, PlotStyle -> Directive[{PointSize[Large], Red}], PlotRange -> {{-20, 20}, {-20, 20}}, AspectRatio -> Automatic] 

enter image description here

Appendix

For another function,NSolve missing some roots.

Clear[f, fig1, fig2]; f[z_] = Sin[z + Sin[z + Sin[z]]] - Cos[z + Cos[z + Cos[z]]]; fig1 = ComplexContourPlot[{Re[f[z]] == 0, Im[f[z]] == 0}, {z, -5 - 4 I, 5 + 4 I}, PlotPoints -> 100, ContourStyle -> {Directive[Brown, Thin], Directive[Cyan, Thin]}, ImageSize -> Full]; roots = NSolve[{f[z] == 0, -5 <= Re[z] <= 5, -4 <= Im[z] <= 4}]; fig2 = ListPlot[ReIm[z] /. roots, PlotStyle -> Directive[{PointSize[Small], Red}], PlotRange -> {{-5, 5}, {-4, 4}}, AspectRatio -> Automatic]; Show[fig1, fig2, ImageSize -> Full] 

enter image description here

$\endgroup$
3
$\begingroup$

Amplifying on answer by Michael Seifert

Clear["Global`*"] sol = Simplify[Reduce[E^-z == z, z], C[1] ∈ Integers] /. {Equal :> Rule, C[1] :> c} (* z -> ProductLog[c, 1] *) roots = Table[z /. sol, {c, -5, 5}]; ListPlot[ReIm@roots] 

enter image description here

$\endgroup$
2
$\begingroup$

I believe that your solutions are the values of the Lambert W-function at 1: $$ z=W_k(1). $$ The index $k$ tells you which of the (infinitely many) branches of the function you're on.

In Mathematica, this function is implemented as ProductLog; so ProductLog[k,1] should produce the desired intersection points for various integer values of k.

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.