m_n_kappa.matrices.LinearEquationsSystem#

class m_n_kappa.matrices.LinearEquationsSystem(coefficients, constants)#

Bases: object

Solve System of linear equations of type :math:`mathbf{A} vec{x} =

ec{b}`

New in version 0.2.0:

coefficientsMatrix

matrix of coefficients \(\mathbf{A}\)

constantsVector

results-vector \(\vec{b}\)

The following Formula is solved easily by m_n_kappa.matrices.LinearEquationSystem

\[ \begin{align}\begin{aligned}\mathbf{A} \vec{x} = \vec{b}\\\text{with}\\\begin{split}\mathbf{A} = \begin{bmatrix} 4 & -2 & 1 \\ -1 & 3 & 4 \\ 5 & -1 & 3 \end{bmatrix} \text{ and }\end{split}\end{aligned}\end{align} \]

ec{b} = begin{bmatrix} 15 \ 15 \ 26 begin{bmatrix}

To define the matrices follow the following steps.

>>> from m_n_kappa.matrices import Matrix, Vector, LinearEquationsSystem
>>> coefficients = Matrix([[4, -2, 1], [-1, 3, 4], [5, -1, 3]])
>>> constants = Vector([15, 15, 26])

The above given Formula is then solved as follows.

>>> LinearEquationsSystem(coefficients, constants).solve()
Vector([2.0, -1.0, 5.0])

Methods

back_substitution(triangle, constants)

solving a system of linear equations consisting of a triangle-matrix and resulting constants by back-substitution

qr_decomposition()

solver of system of linear equations using QR-decomposition <https://en.wikipedia.org/wiki/QR_decomposition>

solve([solver])

solve the system of linear equations using the

Attributes

coefficients

coefficients-matrix

constants

constants, i.e. results of the equation.

Parameters:
static back_substitution(triangle, constants)#

solving a system of linear equations consisting of a triangle-matrix and resulting constants by back-substitution

Parameters:
  • triangle (Matrix) – triangle matrix, where all entries below the diagonal denote to zero

  • constants (Vector) – Resulting vector (given on the right hand side of a Formula)

Returns:

Variables leading to the given result

Return type:

Vector

qr_decomposition()#

solver of system of linear equations using QR-decomposition <https://en.wikipedia.org/wiki/QR_decomposition>

Return type:

Vector

solve(solver='QR-Decomposition')#

solve the system of linear equations using the

Parameters:

solver (str) –

Return type:

Vector

property coefficients: Matrix#

coefficients-matrix

property constants: Vector#

constants, i.e. results of the equation