numeth
A fully functional Python package implementing core numerical methods for engineering and applied mathematics. Designed for usability and educational clarity.
Installation
Install via pip:
pip install numeth
Quick Start
Here's a simple example using the Newton-Raphson method to find the square root of 2:
from numeth import newton_raphson
def f(x):
return x**2 - 2
def df(x):
return 2 * x
root, iterations, converged = newton_raphson(f, df, x0=1.0, tol=1e-6, max_iter=100)
print(f"Root: {root}, Iterations: {iterations}, Converged: {converged}")
# Output: Root: 1.414213562373095, Iterations: 4, Converged: True
Visualization
You can easily visualize the convergence or the results of any numerical method using the .graph() method.
import numeth
# Integration visualization
tr = numeth.trapezoidal(lambda x: x**2, 0, 1)
tr.graph()
# Root finding visualization
sol = numeth.bisection(lambda x: x**2 - 2, 0, 2)
sol.graph()
The .graph() method provides a visual representation of how the algorithm works, including function plots, integration areas, root markers, and tangent lines for differentiation.
Supported Methods for Visualization
Visualization is currently supported for almost all modules:
- Integration: All methods supported.
- Root Finding: All methods supported.
- Differentiation: All methods supported.
- Interpolation: All methods supported.
- Optimization: All methods supported.
Note: Linear Algebra methods (Gauss Elimination, LU Decomposition, Jacobi, Gauss-Seidel) currently do not support .graph() because they operate on vectors/matrices rather than single-variable functions.
Supported Methods
Integration
- Trapezoidal Rule (single and composite)
- Simpson’s 1/3 Rule (single and composite)
- Simpson’s 3/8 Rule
- Gaussian Quadrature (2-point and 3-point)
Differentiation
- Forward difference (first derivative)
- Backward difference (first derivative)
- Central difference (first derivative)
- Central difference (second derivative)
- Richardson extrapolation (first derivative)
Root Finding
- Bisection Method
- Newton-Raphson Method
- Secant Method
- False Position Method
Interpolation
- Linear Interpolation
- Lagrange Interpolation
- Newton’s Divided Difference Interpolation
Linear Algebra
- Gauss Elimination with partial pivoting
- LU Decomposition (Doolittle’s method)
- Jacobi Iterative Method
- Gauss-Seidel Iterative Method
Optimization
- Golden Section Search (minimization)
- Newton’s Method for Optimization (1D)
How to Contribute or Report Issues
Contributions are welcome! Please submit pull requests or open issues on the GitHub repository.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for numeth 1.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| numeth-1.1.5.tar.gz | 13.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| numeth-1.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.2 kB
Release files / numeth-1.1.5.tar.gz
| Download URL | numeth-1.1.5.tar.gz |
|---|---|
| Size | 13.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ad99e74ed1789aca77029ad5563c291237776906398b6be2650c67d5dd5936f1
|
|
BLAKE2b-256 checksum How to use checksums |
a216a0f39fd113284bf940372d1e19f140649e9e7da633142417460fc9b33247
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.7
|
Release files / numeth-1.1.5-py3-none-any.whl
| Download URL | numeth-1.1.5-py3-none-any.whl |
|---|---|
| Size | 13.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fbeb4666b40f3797e9f1710264ab9baab208482b0a3376f49a02dc730f9d0993
|
|
BLAKE2b-256 checksum How to use checksums |
d9b7eeb59b09161afa745129d5261481d81444830ddbde982134c8a1a76fa944
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.7
|