Lightweight matrix-free pseudo-arclength continuation with bifurcation detection and branch switching.
Project description
PyCont
PyCont is a simple, matrix-free pseudo-arclength continuation library for solving parametric nonlinear systems of the form
$$ G(u, p) = 0 $$
with automatic detection of bifurcation points and branch switching. In particular, PyCont uses
- Matrix-free implementation through nonlinear Newton-Krylov solvers
- Precise bifurcation point localization (via bisection)
- Branch switching at bifurcation points
- Lightweight and easy to integrate into your workflows
- No derivatives or Jacobians needed! Everything works directly on the level of G(u, p).
Installation
pip install pycont
Minimal Working Example (Pitchfork Bifurcation)
import numpy as np
import pycont
import matplotlib.pyplot as plt
# Define the pitchfork function
def G(u, p):
return u**3 - p*u
# Initial guess
u0 = np.array([1e-2])
p0 = 0.0
# Run continuation
continuation_result = pycont.pseudoArclengthContinuation(
G,
u0, p0,
ds_min=0.001,
ds_max=0.05,
ds=0.01,
N=200
)
# Plot the solution curve
for n in range(len(continuation_result.branches)):
branch = continuation_result.branches[n]
ax.plot(branch['p'], branch['u'], 'blue')
plt.xlabel('p')
plt.ylabel('u')
plt.title('Bifurcation diagram')
plt.grid()
plt.show()
License
This project is licensed under the MIT License — see the LICENSE file for details.
Acknowledgement
I started this project because there are (in my opinion) no good, lightweight, and easy to use numerical continuation packages in the python ecosystem. These days, researchers are too often forced to use ancient Fortran packages like AUTO, or language-specific tools like MATCONT in Matlab. PyCont seeks to create an elegent package with all features for Python - the default language for scientific computing and machine learning.
If you want to see new features, either contact me or write a pull request. I will continue updating PyCont based on my own needs, and soon PyCont will include Hopf bifurcation detection and limit cycle detection. For questions or requests, feel free to contact me at hannesvdc[at]gmail[dot]com.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycont_lite-0.1.0.tar.gz.
File metadata
- Download URL: pycont_lite-0.1.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c5849251490faa0bc666ebf2c5521f72b6cc3a3cfbfbf06c5843e12fb13899d
|
|
| MD5 |
49041f5519eb698a179715801f037fd5
|
|
| BLAKE2b-256 |
1824cfbea71166db4679e9df0cfbc0daafa0781797b4f804db39684bddbff6eb
|
File details
Details for the file pycont_lite-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pycont_lite-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85fb0a79e578068e30f9f0408b6f7fed678bf307f516e758dc196723f915dabc
|
|
| MD5 |
f6ffecb6bacd940103fed93122a4920d
|
|
| BLAKE2b-256 |
74dd02a577093cc89cf92ebf7124219a1191834a2a4c34e6072d9641d9ddf3c5
|