Metadata-Version: 2.4
Name: nummeth
Version: 0.1.0
Summary: A practical, educational Numerical Methods library with iteration tables for laboratories and engineering.
Author: Numerical Methods Lab
License-Expression: MIT
Keywords: numerical-methods,bisection,newton-raphson,gauss-elimination,interpolation,splines,runge-kutta,heat-equation,wave-equation,laplace-equation
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: plot
Requires-Dist: matplotlib>=3.5.0; extra == "plot"
Provides-Extra: symbolic
Requires-Dist: sympy>=1.10.0; extra == "symbolic"
Provides-Extra: all
Requires-Dist: matplotlib>=3.5.0; extra == "all"
Requires-Dist: sympy>=1.10.0; extra == "all"
Requires-Dist: numpy>=1.20.0; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

# NumMeth (`nummeth`)

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python Versions](https://img.shields.io/badge/python-3.8+-blue.svg)](https://pypi.org/project/nummeth/)

A practical, educational Numerical Methods library designed specifically for **university and engineering laboratories**. 

Unlike generic scientific computing libraries that only return final values, `nummeth` is built for students and instructors:
- **Clean, intuitive APIs** mirroring standard textbooks.
- **Pre-formatted ASCII iteration tables** ready for copy-pasting into lab observation sheets and reports (`show_table=True` or `result.print_table()`).
- **Zero core dependencies** for effortless setup in lab computer networks.

---

## Installation

```bash
pip install nummeth
```

For optional plotting and symbolic mathematics support:
```bash
pip install nummeth[all]
```

---

## Features & Modules

### 1. Roots of Algebraic & Transcendental Equations
- **Bisection Method**: `nm.bisection(f, a, b, tol=1e-5, show_table=True)`
- **Regula-Falsi (False Position)**: `nm.false_position(f, a, b, tol=1e-5, show_table=True)`
- **Newton-Raphson Method**: `nm.newton_raphson(f, x0, df=None, tol=1e-5, show_table=True)`
- **Secant Method**: `nm.secant(f, x0, x1, tol=1e-5, show_table=True)`
- **Fixed-Point Iteration**: `nm.fixed_point(g, x0, tol=1e-5, show_table=True)`

```python
import nummeth as nm

f = lambda x: x**3 - x - 2
res = nm.bisection(f, a=1.0, b=2.0, tol=1e-4, show_table=True)
print(f"Computed root: {res.root}")
```

### 2. Systems of Linear Equations & Eigenvalues
- **Gaussian Elimination** (with or without partial pivoting): `nm.gauss_elimination(A, b, pivoting=True)`
- **Gauss-Jacobi Iteration**: `nm.gauss_jacobi(A, b, show_table=True)`
- **Gauss-Seidel Iteration**: `nm.gauss_seidel(A, b, show_table=True)`
- **Matrix Inversion (Gauss-Jordan)**: `nm.matrix_inverse(A)`
- **Power Method (Dominant Eigenvalue & Eigenvector)**: `nm.power_method(A, show_table=True)`

```python
A = [[10, -1, 2],
     [-1, 11, -1],
     [2, -1, 10]]
b = [6, 25, -11]

res = nm.gauss_seidel(A, b, show_table=True)
print("Solution:", res.solution)
```

### 3. Interpolation & Splines
- **Lagrange Interpolation**: `nm.lagrange_interpolate(x, y, x_eval=6.5, symbolic=True)`
- **Newton's Divided Difference Table & Interpolation**: `nm.divided_difference_interp(x, y, x_eval=3.5, show_table=True)`
- **Newton Forward Difference Table & Interpolation**: `nm.newton_forward_interp(x, y, x_eval=0.2, show_table=True)`
- **Newton Backward Difference Table & Interpolation**: `nm.newton_backward_interp(x, y, x_eval=0.8, show_table=True)`
- **Natural Cubic Spline**: `nm.natural_cubic_spline(x, y, x_eval=2.5, plot=True)`

### 4. Least-Squares Curve Fitting
- **Polynomial Regression**: `nm.polynomial_fit(x, y, degree=1, plot=True)`

### 5. Numerical Calculus (Differentiation & Integration)
- **Finite Difference Derivatives**: `nm.derivative_central(f, x)`
- **Trapezoidal Rule**: `nm.trapezoidal(f, a, b, n)`
- **Simpson's 1/3 Rule**: `nm.simpson_13(f, a, b, n)`
- **Simpson's 3/8 Rule**: `nm.simpson_38(f, a, b, n)`
- **Boole's Rule**: `nm.boole(f, a, b, n)`
- **Weddle's Rule**: `nm.weddle(f, a, b, n)`

```python
f = lambda x: 1.0 / (1.0 + x**2)
res = nm.simpson_13(f, a=0, b=1, n=6)
print(f"Integral = {res.value} (Approximating π/4)")
```

### 6. Ordinary Differential Equations (Initial Value Problems)
- **Euler's Method**: `nm.euler(f, x0, y0, x_end, h, show_table=True)`
- **Modified Euler / Heun's Method**: `nm.modified_euler(f, x0, y0, x_end, h, show_table=True)`
- **Runge-Kutta 2nd Order (RK2)**: `nm.rk2(f, x0, y0, x_end, h, show_table=True)`
- **Runge-Kutta 4th Order (RK4)**: `nm.rk4(f, x0, y0, x_end, h, show_table=True)`
- **Milne's Predictor-Corrector**: `nm.milne_predictor_corrector(f, x0, y0, x_end, h, show_table=True)`

### 7. Finite Difference Methods for PDEs
- **Elliptic (Laplace / Poisson 2D)**: `nm.solve_laplace_2d(nx=4, ny=4, top=100, bottom=0, left=50, right=50)`
- **Parabolic (1D Heat Equation)**:
  - Bender-Schmidt Explicit Scheme: `nm.heat_1d_bender_schmidt(...)`
  - Crank-Nicolson Implicit Scheme: `nm.heat_1d_crank_nicolson(...)`
- **Hyperbolic (1D Wave Equation)**: `nm.wave_1d_explicit(...)`

### 8. Laboratory Applications
- **Circuit Nodal Voltage Solver**: `nm.solve_circuit_nodal(known_voltages, unknown_nodes, resistors)`

---

## Lab Source Preservation
The original lab reference scripts are preserved in the [`sources/`](sources/) directory.

## License
MIT License. Free for educational and commercial use.
