tylerjarvis / RootFinding

Finding zeros of systems of multivariable functions
https://tylerjarvis.github.io/RootFinding/
13 stars 17 forks source link

YRoots

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.

Requirements

At least:

Installation

$ 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)

Usage

#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.

Contributing

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.

License

MIT