Numerical analysis solver for equations and optimization
Project description
NumRoot
Python package for numerical resolution of nonlinear equations with several numerical analysis methods.
🚀 Installation
pip install numroot
Development installation
pip install numroot[dev]
📖 Quick use
from numroot import NonlinearSolver
# Create a solver object
solver = NonlinearSolver()
# Define a function to analyse (example: x² - 2 = 0)
def f(x):
return x**2 - 2
# Bissection method
result = solver.bisection(f, x_a=0, x_b=2, epsilon=1e-6)
print(f"Root found: {result.root}") # ≈ 1.414
print(f"Number of iterations: {result.iterations}")
# Newton-Raphson method
def df(x):
return 2*x
result = solver.newton_raphson(f, df, x_0=1.5, epsilon=1e-6)
print(f"Root found: {result.root}") # ≈ 1.414
print(f"Number of iterations: {result.iterations}")
# Secant method
result = solver.secant(f, x_0=1.0, x_1=2.0, epsilon=1e-6)
print(f"Root found: {result.root}") # ≈ 1.414
print(f"Number of iterations: {result.iterations}")
🔧 Available methods
Bissection method
- Advantages: Always convergent, robust
- Disadvantages: Slow convergence
- Usage: When you have an interval [a,b] where f(a) and f(b) have opposite signs
result = solver.bisection(func, a, b, epsilon=1e-6, maxiter=100)
Newton-Raphson method
- Advantages: Very fast quadratic convergence
- Disadvantages: Requires derivative, may diverge
- Usage: When you know the derivative and have a good initial estimate
result = solver.newton_raphson(func, dfunc, x0, epsilon=1e-6, maxiter=100)
Secant method
- Advantages: No derivative needed, super-linear convergence
- Disadvantages: Can be unstable with bad initial points.
- Uses: Compromise between bisection and Newton-Raphson
result = solver.secant(func, x0, x1, epsilon=1e-6, maxiter=100)
🎯 Typical use cases
- Solving physical equations (trajectories, oscillations)
- Engineering calculations (balance points, intersections)
- Mathematical modeling (zeros of complex functions)
- Research and education in numerical analysis
📋 Requirements
- Python 3.8+
- NumPy >= 1.20.0
🔗 Links
📈 Roadmap
- Systems of non-linear equations
- Ordinary differential equations
- Numerical optimization
- Graphical interface
- Interactive visualizations
📚 References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
numroot-0.1.1.tar.gz
(3.4 kB
view details)
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 numroot-0.1.1.tar.gz.
File metadata
- Download URL: numroot-0.1.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98484f1c098de6859c81d7e80fef74644aa43f3e1f4c9fb3b8c2d295607d9a4c
|
|
| MD5 |
8cd9d9ca0a0acea523c120984cf7cef1
|
|
| BLAKE2b-256 |
ef95dccc3de94a998b6ecb0d639a775d0f05aa45913fab964428ea134c07ddd5
|
File details
Details for the file numroot-0.1.1-py3-none-any.whl.
File metadata
- Download URL: numroot-0.1.1-py3-none-any.whl
- Upload date:
- Size: 2.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83840dbb00fbc844744af4e4ba6ec22d1a0190d31f3580c6c34a8b45e56ab4ab
|
|
| MD5 |
a49d4888226498cc1eba505e21e0d92f
|
|
| BLAKE2b-256 |
a05f3b0bad377a9ad387b78a12b48e275a7ba814519320efd8901028d141ce99
|