YRoots is a Python package designed for numerical rootfinding of multivariate systems of equations.
For a tutorial on YRoots syntax, set-up and examples on how to use it with different function systems, see YRoots Tutorial and for a more detailed demonstration of the code's capabilities on solving more challenging problems, see YRoots Demo.
Documentation is posted at https://tylerjarvis.github.io/RootFinding/
This project was supported in part by the National Science Foundation, grant number DMS-1564502.
At least:
- Python 3.10
- Pip 21.1
- Numpy 1.22.0
- Numba 0.37.0
- Scipy 1.10.0
- Sympy 1.5.1
$ pip install git+https://github.com/tylerjarvis/RootFinding.git
The package can then by imported using import yroots
.
(We are currently working on adding the yroots package to The Python Package Index)
#imports
import numpy as np
import yroots as yr
#define the functions -- must be smooth on the domain and vectorized
f = lambda x,y : np.sin(x*y) + x*np.log(y+3) - x**2 + 1/(y-4)
g = lambda x,y : np.cos(3*x*y) + np.exp(3*y/(x-2)) - x - 6
#define a search domain
a = np.array([-1,-2]) #lower bounds on x and y
b = np.array([0,1]) #upper bounds on x and y
#solve
yr.solve([f,g],a,b)
If the system includes polynomials, there are specialized Polynomial
objects which may be allow for faster solving. See YRoots Tutorial and YRoots Demo for more details.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.