ComplexRegions.jl: A Julia package for regions in the complex plane

Complex variables offer a unique and powerful way to represent planar regions and maps between them. Since the work of Riemann and others in the 19th century, complex variables have been used to derive quantities and properties of importance to a wide range of applications in science and engineering, in addition to their inherent mathematical importance. The advent of computing accelerated and extended this trend to applications in fluids, electromagnetics, queueing theory, computer graphics, and many other fields; e.g., Dias & Elcrat (1992); Driscoll (1994); Gaier (1979); Greengard (1990); Martens, Brown, & Haacke (1992); Trefethen & Williams (1986); Versnel (1982); Gu, Wang, Chan, Thompson, & Yau (2004).


Summary
Complex variables offer a unique and powerful way to represent planar regions and maps between them. Since the work of Riemann and others in the 19th century, complex variables have been used to derive quantities and properties of importance to a wide range of applications in science and engineering, in addition to their inherent mathematical importance. The advent of computing accelerated and extended this trend to applications in fluids, electromagnetics, queueing theory, computer graphics, and many other fields; e.g., Dias & Elcrat (1992); Driscoll (1994); Gaier (1979); Greengard (1990) ;Martens, Brown, & Haacke (1992); Trefethen & Williams (1986); Versnel (1982); Gu, Wang, Chan, Thompson, & Yau (2004).
Software packages for working with complex variables, particularly conformal maps, have been in the public domain for decades (Bjørstad & Grosse, 1987;Crowdy, Kropf, Green, & Nasser, 2016;Driscoll, 1996;Hough & Papamichael, 1983;Hu, 1995;Marshall & Rohde, 2007;Trefethen, 1980). There are additional papers based on research codes that apparently have not made it into the public domain, e.g. DeLillo & Elcrat (1993); Kerzman & Trummer (1986);O'Donnell & Rokhlin (1989). These packages tend to take the traditional form of library routines that require some degree of facility with custom data structures used to represent geometry and functions. Moreover, computational methods are mostly specialized to particular types or classes of regions, leading to parallel and duplicated functionality within a package, and incompatible representations between them.
The ComplexRegions package for Julia provides a software framework for the front end of computations over regions in the extended complex plane. It defines abstract types for curves, paths (i.e., piecewise smooth contours), and regions, defining minimal interfaces for them and providing default behavior based only on the interfaces. These are then implemented as concrete subtypes; e.g., a Circle is a subtype of AbstractClosedCurve, and a Polygon is a subtype of AbstractClosedPath. These types define data structures and methods to operate on them.
Julia's multiple dispatch facility enables some convenient uses of this basic framework. For example, the Base.intersect method is extended to have definitions for many possible pairings of curve and path arguments. In the future, a method for constructing conformal maps, say, could have one method for arguments of types AbstractDisk and PolygonalRe gion that would call upon a Schwarz-Christoffel mapping code. The end user need not know what sort of mapping algorithm is needed for a particular problem, and the master method could easily be extended to numerous other contexts without the need for a "switchyard" portal that could become difficult to maintain.
The ComplexRegions package builds on the ComplexValues package that defines Polar and Spherical types for working with polar and Riemann sphere representations of complex numbers. It also provides recipes for plotting the major abstract types with the popular Plots.jl package. For example: DomainSets ("DomainSets.jl," 2017) and IntervalSets ("IntervalSets.jl," 2016) are a pair of packages with similar goals and interface, but oriented toward the representation of function domains in real spaces. Although ComplexRegions was not consciously patterned after them, there is enough similarity in approach to consider merging the functionality in the future.
One future use case for this package is to implement numerical methods for conformal maps.
Another is for the fast solution of special cases of the Laplace equation that are especially amenable to solution using complex-variable methods (Gopal & Trefethen, 2019).