Meromorphic Functions
The meromorphic module provides tools for constructing meromorphic functions from lists of zeros and poles, generating sympy-compatible mathematical expressions.
Mathematical Background
A meromorphic function is a ratio of holomorphic functions, characterized by its zeros and poles. Given zeros z_1, …, z_m with multiplicities n_1, …, n_m and poles p_1, …, p_k with multiplicities m_1, …, m_k, the function is:
Singularity Class
- class analytic_continuation.Singularity[source]
Bases:
objectA zero or pole with location and multiplicity.
Represents a zero or pole at a specific location with a given multiplicity:
from analytic_continuation import Singularity
# Simple zero at z = 1
zero = Singularity(x=1, y=0)
# Double pole at z = i
pole = Singularity(x=0, y=1, multiplicity=2)
# Convert to complex number
z = zero.z # Returns (1+0j)
Building Expressions
- analytic_continuation.build_meromorphic_expression(zeros, poles, normalize=False)[source]
Build a sympy-compatible expression for a meromorphic function.
- Parameters:
zeros (List[Singularity]) – List of zeros with locations and multiplicities
poles (List[Singularity]) – List of poles with locations and multiplicities
normalize (bool) – If True, add a leading coefficient to normalize (not yet implemented)
- Returns:
Expression string like “(z-1)*(z+1)/((z-i)*(z+i))”
- Return type:
Examples
>>> build_meromorphic_expression( ... zeros=[Singularity(1, 0), Singularity(-1, 0)], ... poles=[Singularity(0, 1), Singularity(0, -1)] ... ) '(z-1)*(z+1)/((z-i)*(z+i))'
Direct function for building expressions:
from analytic_continuation import build_meromorphic_expression, Singularity
zeros = [
Singularity(1, 0), # Zero at z = 1
Singularity(-1, 0), # Zero at z = -1
]
poles = [
Singularity(0, 1), # Pole at z = i
Singularity(0, -1), # Pole at z = -i
]
expr = build_meromorphic_expression(zeros, poles)
# Returns: "(z-1)*(z+1)/((z-i)*(z+i))"
- analytic_continuation.meromorphic_from_points(zeros, poles, zero_multiplicities=None, pole_multiplicities=None)[source]
Convenience function to build expression directly from Point lists.
- Parameters:
- Returns:
Sympy-compatible expression
- Return type:
Convenience function using Point objects:
from analytic_continuation import meromorphic_from_points, Point
zeros = [Point(x=1, y=0), Point(x=-1, y=0)]
poles = [Point(x=0, y=1), Point(x=0, y=-1)]
expr = meromorphic_from_points(zeros, poles)
With multiplicities:
expr = meromorphic_from_points(
zeros=zeros,
poles=poles,
zero_multiplicities=[1, 2], # Simple, then double zero
pole_multiplicities=[1, 1],
)
MeromorphicBuilder Class
- class analytic_continuation.MeromorphicBuilder[source]
Bases:
objectBuilder class for constructing meromorphic functions interactively.
Integrates with SpaceAdapter for coordinate transforms.
- zeros: List[Singularity]
- poles: List[Singularity]
- add_zero(x, y, multiplicity=1)[source]
Add a zero at (x, y) in logical coordinates.
- Parameters:
- Return type:
- add_pole(x, y, multiplicity=1)[source]
Add a pole at (x, y) in logical coordinates.
- Parameters:
- Return type:
- add_zero_from_screen(screen_x, screen_y, adapter, multiplicity=1)[source]
Add a zero from screen coordinates, transforming via adapter.
- add_pole_from_screen(screen_x, screen_y, adapter, multiplicity=1)[source]
Add a pole from screen coordinates, transforming via adapter.
Interactive builder for constructing meromorphic functions:
from analytic_continuation import MeromorphicBuilder
builder = MeromorphicBuilder()
# Add zeros and poles (fluent interface)
builder.add_zero(1, 0).add_zero(-1, 0)
builder.add_pole(0, 1).add_pole(0, -1)
# Build the expression
expr = builder.build_expression()
Adding from Screen Coordinates
The builder integrates with SpaceAdapter for coordinate transforms:
from analytic_continuation import MeromorphicBuilder, SpaceAdapter, TransformParams
params = TransformParams(offset_x=400, offset_y=300, scale_x=100)
adapter = SpaceAdapter(params)
builder = MeromorphicBuilder()
builder.add_zero_from_screen(450, 250, adapter) # Adds zero at (0.5, 0.5)
builder.add_pole_from_screen(350, 350, adapter) # Adds pole at (-0.5, -0.5)
Modifying the Builder
# Remove zeros or poles by index
builder.remove_zero(0)
builder.remove_pole(1)
# Clear all
builder.clear()
Serialization
# Save state
data = builder.to_dict()
# Restore state
restored = MeromorphicBuilder.from_dict(data)
Expression Format
The generated expressions are compatible with sympy and use these conventions:
zis the complex variableirepresents the imaginary unitFactors are written as
(z-a)or(z+a)appropriatelyMultiplicities use exponentiation:
(z-1)^2
Examples of generated expressions:
z # Single zero at origin
(z-1) # Single zero at z=1
(z-1)*(z+1) # Zeros at z=1 and z=-1
z^2/(z-1) # Double zero at origin, pole at z=1
(z-1)*(z+1)/((z-i)*(z+i)) # Complete rational function