linalg(deprecated)/backsub - Help

linalg(deprecated)

 backsub
 back substitution on a matrix

 Calling Sequence backsub(U) backsub(U, b, v)

Parameters

 U - row reduced matrix b - vector or matrix v - (optional) name

Description

 • Important: The linalg package has been deprecated. Use the superseding packages, LinearAlgebra and VectorCalculus, instead.
 - For information on migrating linalg code to the new packages, see examples/LinearAlgebraMigration.
 • backsub generates a solution vector x to the equation $Ux=b$.
 • If b is omitted, or b is 'false' then U is assumed to be an augmented matrix and the last column of U is used in place of b.
 • If b is a matrix, then x (the solution) will also be a matrix with the same number of columns.
 • If U is the result of applying forward Gaussian elimination to the augmented matrix of a system of linear equations, as might be obtained from gausselim or gaussjord, backsub completes the solution by back substitution.  If a solution exists, it is returned as a vector.  If no solution exists, an error will be generated.
 • If the solution is not unique, it will be parameterized in terms of the symbols v[1], v[2], ..., etc. or v[1,k],v[2,k], ... as in the case where b is a matrix. If the third argument v is not specified, the global variable _t will be used.
 • The input matrix must be in row-echelon form with all zero rows grouped at bottom. Such a matrix is produced by applying gausselim or gaussjord to the augmented matrix of a system of linear equations or by obtaining the LU decomposition.
 • The command with(linalg,backsub) allows the use of the abbreviated form of this command.

Examples

Important: The linalg package has been deprecated. Use the superseding packages, LinearAlgebra and VectorCalculus, instead.

 > $\mathrm{with}\left(\mathrm{linalg}\right):$
 > $A≔\mathrm{randmatrix}\left(3,4\right):$
 > $F≔\mathrm{gausselim}\left(A\right)$
 ${F}{:=}\left[\begin{array}{cccc}{-}{7}& {22}& {-}{55}& {-}{94}\\ {0}& \frac{{1522}}{{7}}& {-}\frac{{4785}}{{7}}& {-}\frac{{8612}}{{7}}\\ {0}& {0}& {-}\frac{{56633}}{{1522}}& {-}\frac{{56043}}{{761}}\end{array}\right]$ (1)
 > $\mathrm{backsub}\left(F\right)$
 $\left[\begin{array}{ccc}{-}\frac{{19802}}{{56633}}& \frac{{31937}}{{56633}}& \frac{{112086}}{{56633}}\end{array}\right]$ (2)
 > $H≔\left[\begin{array}{ccc}1& 2& 3\\ 2& 1& 3\\ 1& -1& 0\end{array}\right]:$
 > $v≔\left[\begin{array}{ccc}1& 2& 1\end{array}\right]:$
 > $A≔\mathrm{augment}\left(H,v\right)$
 ${A}{:=}\left[\begin{array}{rrrr}{1}& {2}& {3}& {1}\\ {2}& {1}& {3}& {2}\\ {1}& {-}{1}& {0}& {1}\end{array}\right]$ (3)
 > $F≔\mathrm{gaussjord}\left(A\right)$
 ${F}{:=}\left[\begin{array}{rrrr}{1}& {0}& {1}& {1}\\ {0}& {1}& {1}& {0}\\ {0}& {0}& {0}& {0}\end{array}\right]$ (4)
 > $\mathrm{backsub}\left(F\right)$
 $\left[\begin{array}{ccc}{1}{-}{{\mathrm{_t}}}_{{1}}& {-}{{\mathrm{_t}}}_{{1}}& {{\mathrm{_t}}}_{{1}}\end{array}\right]$ (5)
 > $\mathrm{backsub}\left(F,\mathrm{false},x\right)$
 $\left[\begin{array}{ccc}{1}{-}{{x}}_{{1}}& {-}{{x}}_{{1}}& {{x}}_{{1}}\end{array}\right]$ (6)
 > $u≔\mathrm{LUdecomp}\left(H,L='l'\right)$
 ${u}{:=}\left[\begin{array}{rrr}{1}& {2}& {3}\\ {0}& {-}{3}& {-}{3}\\ {0}& {0}& {0}\end{array}\right]$ (7)
 > $e≔\mathrm{forwardsub}\left(l,v\right)$
 ${e}{:=}\left[\begin{array}{ccc}{1}& {0}& {0}\end{array}\right]$ (8)
 > $f≔\mathrm{backsub}\left(u,e,'s'\right)$
 ${f}{:=}\left[\begin{array}{ccc}{1}{-}{{s}}_{{1}}& {-}{{s}}_{{1}}& {{s}}_{{1}}\end{array}\right]$ (9)
 > $\mathrm{evalm}\left(\left(l&*u\right)&*f-v\right)$
 $\left[\begin{array}{ccc}{0}& {0}& {0}\end{array}\right]$ (10)