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.3.tar.gz (5.5 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.3-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hg22017uno-0.2.3.tar.gz
  • Upload date:
  • Size: 5.5 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.3.tar.gz
Algorithm Hash digest
SHA256 2622cd6abf5b2b836869fbb948c1469cb28110f46750fa505152489db2580c9e
MD5 b250e9dc71fa9a20cabb8cdb0a3bece1
BLAKE2b-256 00201375914e6ba52eb6ce4ee7cd8ee7dc5ae24ec45591156a4481613a8763e1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hg22017uno-0.2.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5861df1b95f81c108d46d04fbe69c5411bd8ddd0f595f42e7d1214b54b1195f8
MD5 d87c950e2f7f25bcf9520d7401a48473
BLAKE2b-256 475d7e0886097ed20c7cfc4f1490d0513f2db28ffebe33511b480b24e21e855c

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