RootsAndPoles

Julia implementation of the global complex root and pole finding (GRPF) algorithm.

https://github.com/fgasdia/rootsandpoles.jl

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: ieee.org, acm.org, zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.4%) to scientific vocabulary

Keywords

complex-numbers complex-roots julia poles-finding root-finding
Last synced: 6 months ago · JSON representation ·

Repository

Julia implementation of the global complex root and pole finding (GRPF) algorithm.

Basic Info
  • Host: GitHub
  • Owner: fgasdia
  • License: mit
  • Language: Julia
  • Default Branch: master
  • Homepage:
  • Size: 1.17 MB
Statistics
  • Stars: 19
  • Watchers: 2
  • Forks: 1
  • Open Issues: 1
  • Releases: 10
Topics
complex-numbers complex-roots julia poles-finding root-finding
Created over 7 years ago · Last pushed 8 months ago
Metadata Files
Readme Changelog License Citation

README.md

RootsAndPoles.jl: Global complex Roots and Poles Finding in Julia

Build Status Build status DOI

A Julia implementation of GRPF by Piotr Kowalczyk.

Description

RootsAndPoles.jl attempts to find all the zeros and poles of a complex valued function with complex arguments in a fixed region. These types of problems are frequently encountered in electromagnetics, but the algorithm can also be used for similar problems in e.g. optics, acoustics, etc.

The GRPF algorithm first samples the function on a triangular mesh through Delaunay triangulation. Candidate regions to search for roots and poles are determined and the discretized Cauchy's argument principle is applied without needing the derivative of the function or integration over the contour. To improve the accuracy of the results, a self-adaptive mesh refinement occurs inside the identified candidate regions.

simplefcn

Usage

Installation

julia ]add RootsAndPoles

Example Problem

Consider a simple rational (complex) argument function simplefcn(z) for which we seek roots and poles. julia function simplefcn(z) w = (z - 1)*(z - im)^2*(z + 1)^3/(z + im) end

Next, we define parameters for the initial complex domain over which we would like to search. julia xb = -2 # real part begin xe = 2 # real part end yb = -2 # imag part begin ye = 2 # imag part end r = 0.1 # initial mesh step tolerance = 1e-9

This package includes convenience functions for rectangular and disk shaped domains, but any "shape" can be used. origcoords below is simply a vector of complex numbers containing the original mesh coordinates which will be Delaunay triangulated. For maximum efficiency, the original mesh nodes should form equilateral triangles. ```julia using RootsAndPoles

origcoords = rectangulardomain(complex(xb, yb), complex(xe, ye), r) ```

Roots and poles can be obtained with the grpf function. We only need to pass the handle to our simplefcn and the origcoords. julia zroots, zpoles = grpf(simplefcn, origcoords)

Additional parameters

Additional parameters can be provided to the tessellation and GRPF algorithms by explicitly passing a GRPFParams struct.

The two most useful parameters are tess_sizehint for the final total number of nodes in the internal DelaunayTessellation2D object and the root finder tolerance at which the mesh refinement stops. Just like sizehint! for other collections, setting tess_sizehint to a value approximately equal to the final number of nodes in the tessellation can improve performance. tolerance is the largest triangle edge length of the candidate edges defined in the origcoords domain. In practice, the root and pole accuracy is a larger value than tolerance, so tolerance needs to be set smaller than the desired tolerance on the roots and poles.

By default, the value of tess_sizehint is 5000 and the tolerance is 1e-9, but they can be specified by providing the GRPFParams argument julia zroots, zpoles = grpf(simplefcn, origcoords, GRPFParams(5000, 1e-9))

Beginning version v1.1.0, calls to the provided function, e.g. simplefcn, can be multithreaded using Julia's @threads capability. The function is called at every node of the triangulation and the results should be independent of one another. For fast-running functions like simplefcn, the overall runtime of grpf is dominated by the Delaunay Triangulation itself, but for more complicated functions, threading can provide a significant advantage. To enable multithreading of the function calls, specify so as a GRPFParams argument julia zroots, zpoles = grpf(simplefcn, origcoords, GRPFParams(5000, 1e-9, true)) By default, multithreading = false.

Additional parameters which can be controlled are maxiterations, maxnodes, and skinnytriangle. maxiterations sets the maximum number of mesh refinement iterations and maxnodes sets the maximum number of nodes allowed in the DelaunayTessellation2D before returning. skinnytriangle is the maximum allowed ratio of the longest to shortest side length in a tessellation triangle before the triangle is automatically subdivided in the mesh refinement step. Default values are

  • maxiterations: 100
  • maxnodes: 500000
  • skinnytriangle: 3

These can be specified along with the tess_sizehint, tolerance and multithreading as, e.g. julia zroots, zpoles = grpf(simplefcn, origcoords, GRPFParams(100, 500000, 3, 5000, 1e-9, true))

Plot data

If mesh node quadrants and phasediffs are wanted for plotting, simply pass a PlotData() instance. julia zroots, zpoles, quadrants, phasediffs, tess, g2f = grpf(simplefcn, origcoords, PlotData())

A GRPFParams can also be passed. julia zroots, zpoles, quadrants, phasediffs, tess, g2f = grpf(simplefcn, origcoords, PlotData(), GRPFParams(5000, 1e-9))

In v1.4.0, a function getplotdata makes plotting the tessellation results more convenient. The code below was used to create the figure shown at the top of the page.

```julia zroots, zpoles, quadrants, phasediffs, tess, g2f = grpf(simplefcn, origcoords, PlotData()); z, edgecolors = getplotdata(tess, quadrants, phasediffs, g2f);

using Plots

pal = ["yellow", "purple", "green", "orange", "black", "cyan"] plot(real(z), imag(z), group=edgecolors, palette=pal, xlabel="Re(z)", ylabel="Im(z)", xlims=(-2, 2), ylims=(-2, 2), legend=:outerright, legendtitle="f(z)", title="Simple rational function", label=["Re > 0, Im ≥ 0" "Re ≤ 0, Im > 0" "Re < 0, Im ≤ 0" "Re ≥ 0, Im < 0" "" ""]) ```

Additional examples

See test/ for additional examples.

Limitations

This package uses VoronoiDelaunay.jl to perform the Delaunay tessellation. VoronoiDelaunay is numerically limited to the range of 1.0+eps(Float64) to 2.0-2eps(Float64) for its point coordinates. RootsAndPoles.jl will accept functions and origcoords that aren't limited to Complex{Float64}, for example Complex{BigFloat}, but the internal tolerance of the root finding is limited to Float64 precision.

Citing

Please consider citing Piotr's publications if this code is used in scientific work:

  1. P. Kowalczyk, “Complex Root Finding Algorithm Based on Delaunay Triangulation”, ACM Transactions on Mathematical Software, vol. 41, no. 3, art. 19, pp. 1-13, June 2015. https://dl.acm.org/citation.cfm?id=2699457

  2. P. Kowalczyk, "Global Complex Roots and Poles Finding Algorithm Based on Phase Analysis for Propagation and Radiation Problems," IEEE Transactions on Antennas and Propagation, vol. 66, no. 12, pp. 7198-7205, Dec. 2018. https://ieeexplore.ieee.org/document/8457320

We also encourage you to cite this package if used in scientific work. Refer to the Zenodo DOI at the top of the page or CITATION.bib.

Owner

  • Name: Forrest Gasdia
  • Login: fgasdia
  • Kind: user

Citation (CITATION.bib)

@misc{Gasdia19,
  author       = {Forrest Gasdia},
  title        = {RootsAndPoles.jl: Global complex Roots and Poles Finding in the Julia programming language},
  year         = 2019,
  url          = {https://github.com/fgasdia/RootsAndPoles.jl},
  doi          = {10.5281/zenodo.3525387}
}

GitHub Events

Total
  • Watch event: 1
  • Push event: 2
Last Year
  • Watch event: 1
  • Push event: 2

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 153
  • Total Committers: 4
  • Avg Commits per committer: 38.25
  • Development Distribution Score (DDS): 0.608
Top Committers
Name Email Commits
fgasdia f****a@n****m 60
Forrest Gasdia E****y@u****m 41
fgasdia 1****a@u****m 27
Forrest Gasdia f****a@u****m 25
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 14
  • Total pull requests: 15
  • Average time to close issues: 3 months
  • Average time to close pull requests: about 18 hours
  • Total issue authors: 3
  • Total pull request authors: 1
  • Average comments per issue: 1.5
  • Average comments per pull request: 0.07
  • Merged pull requests: 15
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • fgasdia (12)
  • githubbjs (1)
  • JuliaTagBot (1)
Pull Request Authors
  • fgasdia (15)
Top Labels
Issue Labels
enhancement (1)
Pull Request Labels
enhancement (1)

Packages

  • Total packages: 1
  • Total downloads:
    • julia 16 total
  • Total dependent packages: 1
  • Total dependent repositories: 0
  • Total versions: 8
juliahub.com: RootsAndPoles

Julia implementation of the global complex root and pole finding (GRPF) algorithm.

  • Versions: 8
  • Dependent Packages: 1
  • Dependent Repositories: 0
  • Downloads: 16 Total
Rankings
Dependent repos count: 9.9%
Dependent packages count: 23.0%
Average: 24.6%
Stargazers count: 25.0%
Forks count: 40.4%
Last synced: 6 months ago

Dependencies

.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite