Skip to main content

A library for solving linear and nonlinear systems of equations using various methods.

Project description

Linear and Nonlinear Solver

This project provides a Python library for solving both linear and nonlinear systems of equations using various numerical methods. The library includes implementations of the following methods:

Linear Methods

  1. Gauss Elimination: A method for solving linear systems by transforming the system into an upper triangular matrix.
  2. Gauss-Jordan Elimination: An extension of Gauss elimination that reduces the matrix to reduced row echelon form.
  3. Cramer's Rule: A method for solving linear systems using determinants, applicable when the system has a unique solution.
  4. LU Decomposition: A method that factors a matrix into a lower triangular matrix and an upper triangular matrix to simplify solving linear systems.

Nonlinear Methods

  1. Jacobi Method: An iterative method for solving a system of nonlinear equations.
  2. Gauss-Seidel Method: An improvement over the Jacobi method that uses the latest available values for faster convergence.
  3. Bisection Method: A root-finding method that repeatedly bisects an interval and selects a subinterval in which a root exists.

Installation

To install the library, clone the repository and run the following command:

pip install .

Usage

Linear Methods

from solver.linear.gauss_elimination import gauss_elimination
from solver.linear.gauss_jordan import gauss_jordan
from solver.linear.cramer_rule import cramer_rule
from solver.linear.lu_decomposition import lu_decomposition

# Example usage
matrix = [[2, 1, -1], [3, 3, 9], [3, 3, 5]]
b = [8, 0, 4]

solution = gauss_elimination(matrix, b)

Nonlinear Methods

from solver.nonlinear.jacobi import jacobi_method
from solver.nonlinear.gauss_seidel import gauss_seidel_method
from solver.nonlinear.bisection import bisection_method

# Example usage
def func(x):
    return x**3 - x - 2

root = bisection_method(func, 1, 2)

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

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

hg22017uno-0.2.2.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

hg22017uno-0.2.2-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file hg22017uno-0.2.2.tar.gz.

File metadata

  • Download URL: hg22017uno-0.2.2.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for hg22017uno-0.2.2.tar.gz
Algorithm Hash digest
SHA256 94cea58581b420fe83b638e19609263a91b6b78bf9774251079501ce0914490b
MD5 046c447f08f6fc541eb2ad9745485f6f
BLAKE2b-256 f5be3de1b8fee916c25ce7a0e3663fbb986374ab0b1dd60b6f8f9700553f5d6d

See more details on using hashes here.

File details

Details for the file hg22017uno-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: hg22017uno-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for hg22017uno-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4ab1e3a87a67b6c2cd0082208a2baa7220a3cc1d115aec42d28b1fee3da01710
MD5 7144a90979a4084fe93c2ae0673734a7
BLAKE2b-256 1faf86552d856bd9ad2476da4b42fe6f7b4d72e5ce6355b39ebe05023a3c4719

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