linear_algebra.gaussian_elimination

Gaussian elimination method for solving a system of linear equations. Gaussian elimination - https://en.wikipedia.org/wiki/Gaussian_elimination

Functions

gaussian_elimination(→ numpy.typing.NDArray[numpy.float64])

This function performs Gaussian elimination method

retroactive_resolution(...)

This function performs a retroactive linear system resolution

Module Contents

linear_algebra.gaussian_elimination.gaussian_elimination(coefficients: numpy.typing.NDArray[numpy.float64], vector: numpy.typing.NDArray[numpy.float64]) numpy.typing.NDArray[numpy.float64]

This function performs Gaussian elimination method

Examples:

1x1 - 4x2 - 2x3 = -2 1x1 + 2x2 = 5 5x1 + 2x2 - 2x3 = -3 5x1 + 2x2 = 5 1x1 - 1x2 + 0x3 = 4

>>> gaussian_elimination([[1, -4, -2], [5, 2, -2], [1, -1, 0]], [[-2], [-3], [4]])
array([[ 2.3 ],
       [-1.7 ],
       [ 5.55]])
>>> gaussian_elimination([[1, 2], [5, 2]], [[5], [5]])
array([[0. ],
       [2.5]])
linear_algebra.gaussian_elimination.retroactive_resolution(coefficients: numpy.typing.NDArray[numpy.float64], vector: numpy.typing.NDArray[numpy.float64]) numpy.typing.NDArray[numpy.float64]
This function performs a retroactive linear system resolution

for triangular matrix

Examples:

2x1 + 2x2 - 1x3 = 5 2x1 + 2x2 = -1 0x1 - 2x2 - 1x3 = -7 0x1 - 2x2 = -1 0x1 + 0x2 + 5x3 = 15

>>> gaussian_elimination([[2, 2, -1], [0, -2, -1], [0, 0, 5]], [[5], [-7], [15]])
array([[2.],
       [2.],
       [3.]])
>>> gaussian_elimination([[2, 2], [0, -2]], [[-1], [-1]])
array([[-1. ],
       [ 0.5]])