Usage from Python
You can call the functions in this package from Python using the PythonCall/JuliaCall package.
Installation
It's recommended to create a new virtual environment to try this out. In Python, you need to install juliacall via
pip install juliacallThen, start Python and run:
from juliacall import Main as jlThis will download and initialize a copy of Julia. Finally, you need to install this package in that Julia environment:
jl.seval('using Pkg; Pkg.add("ComplexRegions")')That should be all you need to set up in the Python environment.
Usage
In each new Python session, you need to load the packages as follows:
from juliacall import Main as jl
jl.seval('using ComplexRegions, PythonCall')All the functions and constants exposed to Julia by this package are available using the jl object. For example, to use the discrete AAA algorithm:
import numpy as np # if installed in Python
a = jl.Arc(-1, 1, -1j)
print(a)Julia:
Arc{Float64} in the complex plane:
fraction 0.75 of (Circle(0.0+0.0im,1.0,cw)) starting at 0.5Above, a is a wrapped Julia object that you can use in Python. For example, you can find a point on the arc:
a(0.5)(0.7071067811865476+0.7071067811865475j)You can get information about the approximation using any documented function in the package, e.g.:
print(jl.inv(a))Julia:
Arc{Float64} in the complex plane:
fraction 0.75 of (Circle(0.0+0.0im,1.0,ccw)) starting at 0.5print(jl.arclength(a))4.71238898038469Native Python interface
There is an alternative (currently experimental) native Python interface called cxregions. See the GitHub home for details.