{"id":37722784,"url":"https://github.com/nennigb/polze","last_synced_at":"2026-01-16T13:34:45.290Z","repository":{"id":47726649,"uuid":"433766195","full_name":"nennigb/polze","owner":"nennigb","description":"A python package to locate poles and zeros of a meromorphic function with their multiplicities","archived":false,"fork":false,"pushed_at":"2024-07-22T07:45:51.000Z","size":86,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-07-22T09:00:53.457Z","etag":null,"topics":["complex-analysis","holomorphic-functions","meromorphic-functions","poles-finding","root-finding","rootfinding"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nennigb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-01T09:40:57.000Z","updated_at":"2024-07-22T07:45:51.000Z","dependencies_parsed_at":"2022-09-08T19:12:56.531Z","dependency_job_id":null,"html_url":"https://github.com/nennigb/polze","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nennigb/polze","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nennigb%2Fpolze","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nennigb%2Fpolze/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nennigb%2Fpolze/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nennigb%2Fpolze/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nennigb","download_url":"https://codeload.github.com/nennigb/polze/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nennigb%2Fpolze/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28479033,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["complex-analysis","holomorphic-functions","meromorphic-functions","poles-finding","root-finding","rootfinding"],"created_at":"2026-01-16T13:34:44.669Z","updated_at":"2026-01-16T13:34:45.275Z","avatar_url":"https://github.com/nennigb.png","language":"Python","readme":"POLZE - A package to locate poles and zeros of a meromorphic function with their multiplicities\n================================================================================================\n\n[![CI-ubuntu](https://github.com/nennigb/polze/actions/workflows/ci-ubuntu.yml/badge.svg)](https://github.com/nennigb/polze/actions/workflows/ci-ubuntu.yml) [![CI-Windows](https://github.com/nennigb/polze/actions/workflows/ci-windows.yml/badge.svg)](https://github.com/nennigb/polze/actions/workflows/ci-windows.yml)\n\nThis python package aims at finding poles and zeros of a meromorphic function with their multiplicities inside a closed contour in the complex plane. All the roots can be found without initial guess.\n\nFor convenience we denote by _root_ a pole or a zero. The method is based on the generalized argument principle :\n\n![\"$$S_n = \\frac{1}{2\\pi i} \\oint_C \\frac{f'(z)}{f(z)} g_n(z) d z = \\sum_{k=1}^{K} \\mu_{k} g_n(z_k),$$\"](doc/eq.png \"The generalized argument principle\")\n \nwhere $C$ is a close path in the complex plane, $\\mu$ is the multiplicity and $g_n$ is a probe function.\nThe summation is done on the $K$ zeros and poles of $f(z)$ inside the contour.\nIt is noteworthy that with this definition poles have negative multiplicity.\n\nThe method applies to **meromorphic** (and also to **holomorphic**) functions, **assuming there is no root on the path $C$**. The derivative may be \ngiven or computed thanks to high-order finite difference stencil.\n\nTheoretical development can be found in Refs. [1, 2]  and the references therein.\nThe approach used here is closer to [2] where the probe functions are $g_n(z) = (z/R)^n$ and \nuse a contour splitting, whereas [1] proposes to use orthogonal polynomial with respect to $f'/f$.\n\nThe main advantage of the contour splitting is its robustness and its simplicity, but the price to pay is the increase of the number \nof function evaluations, since the integral need to be evaluated for each contour. The overhead appears only for significant number\nof roots (say more than 10). This bound depends on the roots distribution [2]. The ideal case is when the roots are uniformly\ndistributed around the integration contour.\n\nFor this kind of solver, it is generally better to increase the number of contour splits than the number of integration points.\n\n\n![Examples of poles and zeros location in the complex plane.](doc/mapz_rat.png \"Comparison between `polze` and brute force computation on a rational fraction. The '+' and '.' markers stand for poles and zeros respectively. The grey lines shows the different contours.\")\n\nComputation steps\n-----------------\n1. Compute the _moments_\n2. Solve the _generalized eigenvalue problem_ involving Hankel matrix [1, 2] to get the roots\n3. Solve the _Vandermonde system_ to recover the multiplicity\n4. Remove the _spurious_ roots. If the rank is not well determined, we get the genuine roots and some spurious ones [2]. Spurious ones have a ~0 multiplicity.\n \n\nReferences\n----------\n\n  [1] Kravanja, Peter, Marc Van Barel, and Ann Haegemans. \"On computing zeros and poles of meromorphic functions.\" Series in Approximations and Decompositions 11 (1999): 359-370.\n\n  [2] Chen, Hao-Tian. \"On locating the zeros and poles of a meromorphic function.\" (2018).\n\n\nDependencies\n------------\n`polze` is based on `numpy`, `scipy` and `matplotlib`.\n\n\nInstall\n-------\n`polze` is designed as a standard python package. The installation can be done after cloning or downloading the repos, using \n```\npip3 install path/to/polze [--user]\n```\nor in _editable_ mode if you want to modify the sources\n```\npip3 install -e path/to/polze\n```\nNote that on some systems (like ubuntu), `python3` or `pip3` should be use to call python v3.x\n\n\nRunnig tests\n------------\nTests are handled with `doctest` and `unittest`. To call the test procedure, simply execute the `test` module\n```\npython -m polze.test\n```\n\n\nView documentation\n------------------\nThe doctrings are compatible with several Auto-generate API documentation, like `pdoc3`. Once the package has been installed or the at `polze` location run,\n```\npdoc3 --html --force --config latex_math=True polze\n```\nThe html files are generated in place. Then open the `polze/index.html` file. This interactive doc is particularly useful to see latex includes.\n\n\nGet a started\n-------------\n```python\n# Definition of the function\nf = lambda z: np.tan(z)\ndf = lambda z: np.tan(z)**2 + 1 # [df is optional]\n# Initialization of the solver\npz = PZ((f, df), Rmax=5, Npz=10, Ni=1024)\n# Solve with moment method\npz.solve()\n# Get the poles p and the zeros z\np, z = pz.dispatch()\n# plot the roots\npz.plot()\n# Performed an iterative refinement with Newton-Raphson method\npr, info = pz.iterative_ref()\n```\n\nLimitations\n-----------\nFor now, `polze` use only circular integration contours in _z_ and a single kind of probe function. The contour splitting is done _a priori_ using the estimate of the number of roots (`Npz`), ie no error estimators are used.\n\n\nRelated projects\n----------------\n[`cxroots`](https://github.com/rparini/cxroots) is a Python package for finding all the roots of a function, f(z), of a single complex variable within a given contour, C, in the complex plane.\n  This approach has he same theoretical basis than `polze` but is (now) limited to _analytic_ functions.\n\n\nHow to contribute ?\n-------------------\nIf you want to contribute to `polze`, your are welcomed! Don't hesitate to\n\n  - report bugs, installation problems or ask questions on [issues](https://github.com/nennigb/polze/issues);\n  - propose some enhancements in the code or in the documentation through **pull requests** (PR);\n  - suggest or report some possible new usages and why not start a scientific collaboration ;-)\n  - ...\n  \nTo ensure code homogeneity among contributors, we use a source-code analyzer (eg. pylint). \nBefore submitting a PR, run the tests suite. New tests should be added if new functionnalies are added.\n\nLicense\n-------\n`polze` is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n`polze` is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License along with `polze`.  If not, see \u003chttps://www.gnu.org/licenses/\u003e.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnennigb%2Fpolze","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnennigb%2Fpolze","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnennigb%2Fpolze/lists"}