I'm trying to plot the roots of a complex equation, $p(z)=0$, and a domain, $D$, but have not found a clever way to cover general domains.

If we, e.g., take the equation $p(z)=5 z^3 + 9 z^2 - 25 z + 21 = 0$ with the domain $D:|z-1|<1$ an illustration can be given by

equation = 5 z^3 + 9 z^2 - 25 z + 21 == 0;
domain = Disk[{1, 0}, 1];
roots = z /. NSolve[equation, z];
roots // TableForm
points = ReIm[roots];
p = Graphics[{PointSize[Large], Red, Point[points]}];
d = Graphics[{EdgeForm[Dashed], Opacity[0.1], Blue, domain}];
Show[d, p, Axes -> True, Frame -> True]

The specification of $p(z)$ is quite good, but on the 3rd line, defining $D$, the way $D$ is specified is very limiting, as is the EgdeForm[Dashed] later on to indicate that the border of $D$ is not included in the domain. If $D$ where a more complex area, with the border included ("$...\le ...$"), this code would have to be modified in several places.

Is there are better way to plot complex roots and a domain (with or without the border)? TIA.


1 Answer 1


In older versions of Mathematica (like the one currently installed on the computer I am borrowing), I would have either done what you did, or use RegionPlot[] with appropriate conversions for domains more complicated than a disk.

Otherwise, the availability of ComplexRegionPlot[] and ComplexListPlot[] in version 12.1 makes things vastly easier:

Show[ComplexRegionPlot[Abs[z - 1] < 1, {z, -4 - 2 I, 3 + 2 I},
                       AspectRatio -> Automatic, BoundaryStyle -> Dashed],
     ComplexListPlot[z /. NSolve[5 z^3 + 9 z^2 - 25 z + 21 == 0, z],
                     PlotMarkers -> Style["■", Large], PlotStyle -> Red]]

disk and polynomial roots

Note the use of BoundaryStyle -> Dashed to indicate that the region is open.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.