regions

regions

Region classes for the cxregions package.

This module contains all region-related classes including the base JuliaRegion class and specific region types like Interior1CRegion, Exterior1CRegion, and Annulus.

Attributes

Name Description
lefthalfplane Left half-plane region (Re(z) < 0).
lowerhalfplane Lower half-plane region (Im(z) < 0).
righthalfplane Right half-plane region (Re(z) > 0).
unitdisk Unit disk region (|z| < 1).
upperhalfplane Upper half-plane region (Im(z) > 0).

Classes

Name Description
Annulus An annulus (ring-shaped region) between two circles.
Exterior1CRegion Simply connected exterior region.
ExteriorRegion Exterior region with multiple inner boundaries.
Interior1CRegion Simply connected interior region.
InteriorConnectedRegion Multiply connected interior region.
JuliaRegion Base class for wrapping Julia region objects from ComplexRegions.jl.

Annulus

regions.Annulus(outer, inner=None, center=0j)

An annulus (ring-shaped region) between two circles.

This represents the region between an inner and outer circle.

Parameters

Name Type Description Default
outer float, Circle, or juliacall.AnyValue Outer radius, outer circle, or Julia Annulus object required
inner float or Circle Inner radius or inner circle None
center complex Center point (if constructing from radii), default is 0 0j

Attributes

Name Type Description
inner Circle Inner boundary circle
outer Circle Outer boundary circle

Examples

>>> # Annulus from radii
>>> annulus1 = Annulus(2, 1, center=0)
>>> # Annulus from circles
>>> from cxregions.curves import Circle
>>> inner_circle = Circle(0, 1)
>>> outer_circle = Circle(0, 2)
>>> annulus2 = Annulus(outer_circle, inner_circle)

Methods

Name Description
isfinite Check if the annulus is finite.
modulus Compute the modulus of the annulus.
isfinite
regions.Annulus.isfinite()

Check if the annulus is finite.

Returns
Name Type Description
bool Always returns True for annuli
modulus
regions.Annulus.modulus()

Compute the modulus of the annulus.

Returns
Name Type Description
float The modulus (related to the ratio of radii)

Exterior1CRegion

regions.Exterior1CRegion(boundary)

Simply connected exterior region.

This represents the region outside a single closed curve, extending to infinity.

Parameters

Name Type Description Default
boundary ClosedCurve, ClosedPath, or juliacall.AnyValue The boundary curve of the region required

Attributes

Name Type Description
boundary ClosedCurve or ClosedPath The boundary curve of the region

Examples

>>> from cxregions.curves import Circle
>>> circle = Circle(0, 1)
>>> exterior = Exterior1CRegion(circle)

Methods

Name Description
isfinite Check if the region is finite.
isfinite
regions.Exterior1CRegion.isfinite()

Check if the region is finite.

Returns
Name Type Description
bool True if the boundary is finite, False otherwise

ExteriorRegion

regions.ExteriorRegion(inner)

Exterior region with multiple inner boundaries.

This represents the region outside multiple closed curves, extending to infinity.

Parameters

Name Type Description Default
inner list of ClosedCurve/ClosedPath or juliacall.AnyValue The inner boundary curves required

Attributes

Name Type Description
inner list of ClosedCurve/ClosedPath The inner boundary curves

Examples

>>> from cxregions.curves import Circle
>>> circle1 = Circle(0, 1)
>>> circle2 = Circle(3, 0.5)
>>> exterior = ExteriorRegion([circle1, circle2])

Methods

Name Description
isfinite Check if the region is finite.
isfinite
regions.ExteriorRegion.isfinite()

Check if the region is finite.

Returns
Name Type Description
bool Always returns False for exterior regions

Interior1CRegion

regions.Interior1CRegion(boundary)

Simply connected interior region.

This represents the region inside a single closed curve.

Parameters

Name Type Description Default
boundary ClosedCurve, ClosedPath, or juliacall.AnyValue The boundary curve of the region required

Attributes

Name Type Description
boundary ClosedCurve or ClosedPath The boundary curve of the region

Examples

>>> from cxregions.curves import Circle
>>> circle = Circle(0, 1)
>>> interior = Interior1CRegion(circle)

Methods

Name Description
isfinite Check if the region is finite.
isfinite
regions.Interior1CRegion.isfinite()

Check if the region is finite.

Returns
Name Type Description
bool True if the boundary is finite, False otherwise

InteriorConnectedRegion

regions.InteriorConnectedRegion(outer, inner=[])

Multiply connected interior region.

This represents the region inside an outer boundary but outside inner boundaries.

Parameters

Name Type Description Default
outer ClosedCurve, ClosedPath, or juliacall.AnyValue The outer boundary curve required
inner list of ClosedCurve/ClosedPath The inner boundary curves (holes) []

Attributes

Name Type Description
outer ClosedCurve or ClosedPath The outer boundary curve
inner list of ClosedCurve/ClosedPath The inner boundary curves

Examples

>>> from cxregions.curves import Circle
>>> outer_circle = Circle(0, 2)
>>> inner_circle = Circle(0, 1)
>>> region = InteriorConnectedRegion(outer_circle, [inner_circle])

Methods

Name Description
isfinite Check if the region is finite.
isfinite
regions.InteriorConnectedRegion.isfinite()

Check if the region is finite.

Returns
Name Type Description
bool True if all boundaries are finite, False otherwise

JuliaRegion

regions.JuliaRegion(julia_obj)

Base class for wrapping Julia region objects from ComplexRegions.jl.

This class provides a Python interface to Julia region objects, which represent areas in the complex plane bounded by curves.

Parameters

Name Type Description Default
julia_obj juliacall.AnyValue A Julia region object from ComplexRegions.jl required

Attributes

Name Type Description
julia juliacall.AnyValue The underlying Julia region object

Methods

Name Description
contains Check if a point is contained in the region.
get Get a field from the underlying Julia object.
innerboundary Get the inner boundary curves of the region.
intersect Compute the intersection of this region with another.
outerboundary Get the outer boundary curves of the region.
union Compute the union of this region with another.
contains
regions.JuliaRegion.contains(z=None)

Check if a point is contained in the region.

Parameters
Name Type Description Default
z complex Point to test for containment None
Returns
Name Type Description
bool True if z is in the region, False otherwise
get
regions.JuliaRegion.get(field)

Get a field from the underlying Julia object.

Parameters
Name Type Description Default
field str Name of the field to retrieve required
Returns
Name Type Description
Any The value of the requested field
innerboundary
regions.JuliaRegion.innerboundary()

Get the inner boundary curves of the region.

Returns
Name Type Description
JuliaPath or list of JuliaPath Inner boundary curve(s) of the region
intersect
regions.JuliaRegion.intersect(other)

Compute the intersection of this region with another.

Parameters
Name Type Description Default
other JuliaRegion Another region to intersect with required
Returns
Name Type Description
JuliaRegion Intersection of the two regions
outerboundary
regions.JuliaRegion.outerboundary()

Get the outer boundary curves of the region.

Returns
Name Type Description
JuliaPath or list of JuliaPath Outer boundary curve(s) of the region
union
regions.JuliaRegion.union(other)

Compute the union of this region with another.

Parameters
Name Type Description Default
other JuliaRegion Another region to union with required
Returns
Name Type Description
JuliaRegion Union of the two regions

Functions

Name Description
Jordan Construct a Jordan curve from a ClosedPath or ClosedCurve object.
between Construct the region between two closed curves.
disk Construct a disk as an interior region.
exterior Construct the exterior region of a closed curve.
get_julia Extract the Julia object from a Python wrapper.
halfplane Construct a half-plane as an interior region from a Line.
interior Construct the interior region of a closed curve.
wrap_jl_region Wrap a Julia region object in the appropriate Python class.

Jordan

regions.Jordan(c)

Construct a Jordan curve from a ClosedPath or ClosedCurve object.

Parameters

Name Type Description Default
c ClosedPath, ClosedCurve, or juliacall.AnyValue A closed curve or path object required

Returns

Name Type Description
ClosedPath or ClosedCurve The input object if already a Jordan curve, or wrapped appropriately

Raises

Name Type Description
ValueError If the argument is not a valid closed curve or path

between

regions.between(curve1, curve2)

Construct the region between two closed curves.

Parameters

Name Type Description Default
curve1 ClosedCurve or ClosedPath First boundary curve required
curve2 ClosedCurve or ClosedPath Second boundary curve required

Returns

Name Type Description
InteriorConnectedRegion Region between the two curves

Examples

>>> from cxregions.curves import Circle
>>> outer = Circle(0, 2)
>>> inner = Circle(0, 1)
>>> region = between(outer, inner)

disk

regions.disk(center, radius)

Construct a disk as an interior region.

Parameters

Name Type Description Default
center complex Center of the disk required
radius float Radius of the disk required

Returns

Name Type Description
Interior1CRegion Disk region

Examples

>>> disk_region = disk(1+1j, 2)

exterior

regions.exterior(curve)

Construct the exterior region of a closed curve.

Parameters

Name Type Description Default
curve ClosedCurve or ClosedPath Boundary curve required

Returns

Name Type Description
Exterior1CRegion Exterior region of the curve

Examples

>>> from cxregions.curves import Circle
>>> circle = Circle(0, 1)
>>> region = exterior(circle)

get_julia

regions.get_julia(p)

Extract the Julia object from a Python wrapper.

Parameters

Name Type Description Default
p JuliaCurve, JuliaPath, or other Python wrapper object or raw Julia object required

Returns

Name Type Description
juliacall.AnyValue or other The underlying Julia object, or the input if not a wrapper

halfplane

regions.halfplane(l)

Construct a half-plane as an interior region from a Line.

Parameters

Name Type Description Default
l Line Line that forms the boundary of the half-plane required

Returns

Name Type Description
Interior1CRegion Half-plane region

Examples

>>> from cxregions.curves import Line
>>> line = Line(0, direction=1)
>>> hp = halfplane(line)

interior

regions.interior(curve)

Construct the interior region of a closed curve.

Parameters

Name Type Description Default
curve ClosedCurve or ClosedPath Boundary curve required

Returns

Name Type Description
Interior1CRegion Interior region of the curve

Examples

>>> from cxregions.curves import Circle
>>> circle = Circle(0, 1)
>>> region = interior(circle)

wrap_jl_region

regions.wrap_jl_region(jul)

Wrap a Julia region object in the appropriate Python class.

Parameters

Name Type Description Default
jul juliacall.AnyValue A Julia region object from ComplexRegions.jl required

Returns

Name Type Description
JuliaRegion The appropriate Python region wrapper

Raises

Name Type Description
ValueError If the argument is not a Julia object or not a recognized region type