/RootFinding

A numerical root-finding method for nonlinear systems of equations.

Primary LanguageJupyter Notebook

YRoots

YRoots is a Python package for numerical root finding. See DemoNotebook.ipynb for a JupyterNotebook demonstration of the code's capabilities. This project was supported in part by the National Science Foundation, grant number DMS-1564502.

Requirements

  • Python 3.5 and up

Installation

$ git clone https://github.com/tylerjarvis/RootFinding.git

(We are currently working on getting a pip or conda for download)

Rootfinding can now be installed locally by using pip install -e . while inside the RootFinding folder. The package can then by imported using import yroots.

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 the DemoNotebook.ipynb for 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.

Build status

master develop
Status Build Status Build Status
Codecov Coverage Status Coverage Status

License

MIT