Skip to main content

Coordinate transforms, Laurent series fitting, and analytic continuation pipeline utilities for complex analysis

Project description

analytic-continuation

A Python package for coordinate transforms, Laurent series fitting, and analytic continuation pipeline utilities for complex analysis visualizations.

Overview

This package provides tools for working with complex analysis, particularly focused on:

  • Coordinate Transforms: Transform between screen space and logical (complex plane) coordinates with the SpaceAdapter class
  • Laurent Series Fitting: Fit Laurent maps to Jordan curves, mapping the unit circle to approximate curve boundaries
  • Meromorphic Function Construction: Build meromorphic functions from zeros and poles with proper mathematical expressions
  • Analytic Continuation Pipeline: Utilities for holomorphic checking, inversion, and composition operations
  • Intrinsic Curve Analysis: Analyze curves using Cesaro and Whewell representations
  • Progress Tracking: Pipeline stage tracking and logging infrastructure

Installation

pip install analytic-continuation

For development:

pip install analytic-continuation[dev]

Quick Start

SpaceAdapter for Coordinate Transforms

from analytic_continuation import SpaceAdapter, TransformParams

# Create an adapter for a 800x600 screen viewing [-2, 2] x [-1.5, 1.5]
params = TransformParams.from_view_bounds(
    screen_width=800,
    screen_height=600,
    logical_x_range=(-2, 2),
    logical_y_range=(-1.5, 1.5),
)
adapter = SpaceAdapter(params)

# Convert screen coordinates to complex numbers
z = adapter.screen_to_complex(400, 300)  # Returns 0+0j (center)

# Convert complex numbers to screen coordinates
screen_x, screen_y = adapter.complex_to_screen(1 + 1j)

Laurent Series Fitting

from analytic_continuation import (
    LaurentFitConfig,
    fit_laurent_map,
    SplineExport,
)

# Load curve data from a SplineExport
with open("curve.json") as f:
    export = SplineExport.from_json(f.read())

# Fit a Laurent map
config = LaurentFitConfig(N_min=6, N_max=32)
result = fit_laurent_map(export, config)

if result.ok:
    # Evaluate the map at points on the unit circle
    import numpy as np
    thetas = np.linspace(0, 2 * np.pi, 100)
    zetas = np.exp(1j * thetas)
    curve_points = result.laurent_map.eval_array(zetas)

Meromorphic Function Builder

from analytic_continuation import MeromorphicBuilder, Singularity

# Build a meromorphic function with zeros and poles
builder = MeromorphicBuilder()
builder.add_zero(1, 0)   # Zero at z = 1
builder.add_zero(-1, 0)  # Zero at z = -1
builder.add_pole(0, 1)   # Pole at z = i
builder.add_pole(0, -1)  # Pole at z = -i

expr = builder.build_expression()
# Returns: "(z-1)*(z+1)/((z-i)*(z+i))"

Analytic Continuation Pipeline

from analytic_continuation import (
    check_f_holomorphic_on_annulus,
    invert_z,
    compute_composition,
    HolomorphicCheckConfig,
    InvertConfig,
)

# Check if a function is holomorphic on an annulus
config = HolomorphicCheckConfig(rho_in=0.5, rho_out=2.0)
result = check_f_holomorphic_on_annulus(laurent_map, config)

# Compute the inverse map
invert_cfg = InvertConfig(max_iter=100, tol=1e-10)
inv_result = invert_z(laurent_map, target_z, invert_cfg)

Core Components

Types Module

  • Point: 2D point with optional index, convertible to/from complex numbers
  • Spline: Sequence of points forming a spline or polyline
  • SplineExport: Full spline export structure matching frontend format
  • LaurentMap: Laurent series coefficients for serialization
  • Complex: Serializable complex number representation

SpaceAdapter Module

  • TransformParams: Parameters for screen-to-logical coordinate transforms
  • SpaceAdapter: Main class for coordinate transformations

Laurent Module

  • LaurentFitConfig: Configuration for Laurent map fitting
  • LaurentMapResult: Result of Laurent map evaluation with coefficients
  • FitResult: Complete fitting result including quality metrics
  • fit_laurent_map(): Main entry point for Stage 3 fitting

Meromorphic Module

  • Singularity: Zero or pole with location and multiplicity
  • MeromorphicBuilder: Builder class for constructing meromorphic functions
  • build_meromorphic_expression(): Build sympy-compatible expressions

Continuation Module

  • Pole: Pole location with residue information
  • HolomorphicCheckConfig / HolomorphicCheckResult: Holomorphic checking
  • InvertConfig / InvertResult: Inversion configuration and results
  • CompositionResult: Composition computation results
  • check_f_holomorphic_on_annulus(): Check holomorphicity on annulus
  • invert_z(): Compute inverse mapping
  • compute_composition(): Compute function compositions
  • compute_continuation_grid(): Compute continuation on a grid

Intrinsic Curve Module

  • CesaroRepresentation: Cesaro (curvature vs arc length) form
  • WhewellRepresentation: Whewell (tangent angle vs arc length) form
  • IntrinsicCurveAnalysis: Complete intrinsic curve analysis
  • analyze_bijection(): Analyze a bijection between curves
  • precheck_contour(): Quick pre-check for raw contours (Stage 1 gate)

Logging and Progress

  • PipelineLogger: Structured logging for pipeline stages
  • ProgressTracker: Track progress through pipeline stages
  • TaskStatus / TaskProgress: Task status tracking
  • format_cli_progress(): Format progress for CLI display

Pipeline Stages

The package implements utilities for a multi-stage analytic continuation pipeline:

  1. Stage 1: Contour pre-check and validation
  2. Stage 2: Intrinsic curve analysis (Cesaro/Whewell forms)
  3. Stage 3: Laurent map fitting (main fitting stage)
  4. Stage 4: Holomorphic checking on annulus
  5. Stage 5: Inversion computation
  6. Stage 6: Composition and continuation grid computation

Development

Running Tests

pytest tests/

Building Documentation

cd docs
make html

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

analytic_continuation-0.1.0.tar.gz (70.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

analytic_continuation-0.1.0-py3-none-any.whl (50.2 kB view details)

Uploaded Python 3

File details

Details for the file analytic_continuation-0.1.0.tar.gz.

File metadata

  • Download URL: analytic_continuation-0.1.0.tar.gz
  • Upload date:
  • Size: 70.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for analytic_continuation-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1083f29354cad30b3cf8262a1d3e7e0bca531b7bd77c8c423c29a66225a94516
MD5 b7c3e0c9c77ee2af6a283f63ac8f604b
BLAKE2b-256 8b7203f81213b9094652e324e9a55e289930429a1524cdab8209932356d3f67b

See more details on using hashes here.

File details

Details for the file analytic_continuation-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for analytic_continuation-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 31be56923848e5079398be24d3837b46e96dc4b2d5e95b2b2d050e30e47fb9fa
MD5 d801dbf927ec37cce7bebc6b6d3419b8
BLAKE2b-256 ceaa44dc920aa40a2f0ae5463f0fa6cec54110759ac32cc854ff4cbc8c460732

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page