Skip to main content

A set of core numerical methods used in engineering and applied mathematics

Project description

numeth Logo

PyPI version PyPI downloads License

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

numeth-1.1.3.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

numeth-1.1.3-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file numeth-1.1.3.tar.gz.

File metadata

  • Download URL: numeth-1.1.3.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for numeth-1.1.3.tar.gz
Algorithm Hash digest
SHA256 022221941fe0b35c8387aad832668e88230ccd1cbb722dc1664ff0946089cb11
MD5 f9d402e8e762fea4debb38fcf087b8d8
BLAKE2b-256 8de63fb3915172f2a404af1fd003cabe5e0d404223a5293e5a7860d16e6d8e98

See more details on using hashes here.

File details

Details for the file numeth-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: numeth-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for numeth-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 faeef5c7bfc3e110840fd199972ca500bb2e1f0c73be4f1fc150bf240e934a38
MD5 dc1da0a34e57b57f45ba3058a9bfa9d2
BLAKE2b-256 f94cb089e4d4227b1af9e63fd7959bacc201c25c6093663340adafca2bac13d9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page