2025-09-16 10:47:29 +03:00
2025-09-15 10:40:52 +03:00
2025-09-16 10:47:29 +03:00
2025-09-11 16:39:43 +03:00
2025-09-16 10:45:20 +03:00
2025-09-13 16:18:58 +03:00
2025-09-15 10:55:54 +03:00
2025-09-11 16:36:19 +03:00
2025-09-11 16:37:41 +03:00
2025-09-15 16:47:16 +03:00

numethods

A lightweight, from-scratch, object-oriented Python package implementing classic numerical methods.
No NumPy / SciPy solvers used, algorithms are implemented transparently for learning and research.

Why this might be useful

  • Great for teaching/learning numerical methods step by step.
  • Good reference for people writing their own solvers in C/Fortran/Julia.
  • Lightweight, no dependencies.
  • Consistent object-oriented API (.solve() etc).

Features

Linear system solvers

  • LU decomposition (with partial pivoting): LUDecomposition
  • Gauss-Jordan elimination: GaussJordan
  • Jacobi iterative method: Jacobi
  • Gauss-Seidel iterative method: GaussSeidel
  • Cholesky factorization (SPD): Cholesky

Root-finding

  • Bisection: Bisection
  • Fixed-Point Iteration: FixedPoint
  • Secant: Secant
  • Newton's method (for roots): NewtonRoot

Interpolation

  • Newton (divided differences): NewtonInterpolation
  • Lagrange polynomials: LagrangeInterpolation

Orthogonalization, QR, and Least Squares

  • Classical Gram-Schmidt: QRGramSchmidt
  • Modified Gram-Schmidt: QRModifiedGramSchmidt
  • Householder QR (numerically stable): QRHouseholder
  • QR-based linear solver (square systems): QRSolver
  • Least Squares for overdetermined systems (via QR): LeastSquaresSolver

Numerical Differentiation

  • Forward difference: ForwardDiff
  • Backward difference: BackwardDiff
  • Central difference (2nd order): CentralDiff
  • Central difference (4th order): CentralDiff4th
  • Second derivative: SecondDerivative
  • Richardson extrapolation: RichardsonExtrap

Matrix & Vector utilities

  • Minimal Matrix / Vector classes
  • @ operator for matrix multiplication
  • * for scalar-matrix multiplication
  • .T for transpose
  • Forward / backward substitution helpers
  • Norms, dot products, row/column access

Install (editable)

pip install -e /numethods

or just add /numethods to PYTHONPATH.

Examples

python /numethods/examples/demo.py

Notes

  • All algorithms are implemented without relying on external linear algebra solvers.
  • Uses plain Python floats and list-of-lists for matrices/vectors.
  • Tolerances use a relative criterion |Δ| ≤ tol (1 + |value|).
Description
A small, from-scratch, object-oriented Python package implementing classic numerical methods.
Readme MIT 505 KiB
Languages
Jupyter Notebook 80.4%
Python 19.6%