LinearAlgebra - Maple Programming Help

Home : Support : Online Help : Mathematics : Linear Algebra : LinearAlgebra Package : Solvers : LinearAlgebra/BackwardSubstitute

LinearAlgebra

 BackwardSubstitute
 solve A . X = B where A is in upper row echelon form
 ForwardSubstitute
 solve A . X = B where A is in lower row echelon form

 Calling Sequence BackwardSubstitute(A, B, t, ip, options) ForwardSubstitute(A, B, t, ip, options)

Parameters

 A - row echelon form Matrix B - (optional) Matrix or Vector t - (optional) equation of the form free = symbol; variable for parametrization of infinite solution sets ip - (optional) BooleanOpt(inplace); specifies if output overwrites parameter B when A is square options - (optional); constructor options for the transformation Matrix C

Description

 • The BackwardSubstitute(A, B) function, where A is an upper row echelon Matrix,  returns a solution to the equation $A\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}.\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}X=B$.
 The ForwardSubstitute(A, B) function, where A is a lower row echelon Matrix,  returns a solution to the equation $A\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}.\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}X=B$.
 For each column b of B, this routine performs backwards (or forwards) substitution to obtain a solution x of $A\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}.\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}x=b$. These solution Vectors form a Matrix (or, singly, a Vector) solution which is returned. If no such solution Vector x exists for any column b (e.g., both A is not upper (or lower) triangular and the substitution is inconsistent), then an error is returned.
 If the substitution does not result in a unique solution, then the infinite family of possible solutions will be parametrized as follows:
 *  If B is a Vector, then the solution is parametrized by t[1], t[2], etc, as needed.
 *  If B is a Matrix, then the jth column of the solution Matrix is parametrized by t[1,j], t[2,j], etc, as needed.
 If the parameter t is not provided, then an unassigned name _t<#> is generated.  For example, if _t0, _t1.._t are all assigned, but _t is not assigned, then _t is the generated name.
 If B is not included in the calling sequence, A is assumed to be an augmented Matrix.
 • The inplace option (ip) determines where the result is returned.  If given as inplace=true and A is a square Matrix, the result overwrites the second argument B. If given as inplace=false, or if this option is not included in the calling sequence, the result is returned in a new Matrix or Vector.
 The condition inplace=true can be abbreviated to inplace.
 The inplace option must be used with caution since, if the operation fails, the original Matrix argument may be corrupted.
 • The constructor options provide additional information (readonly, shape, storage, order,datatype, and attributes) to the Matrix or Vector constructor that builds the result. These options may also be provided in the form outputoptions=[...], where [...] represents a Maple list.  If a constructor option is provided in both the calling sequence directly and in an outputoptions option, the latter takes precedence (regardless of the order).
 • The inplace and constructor options are mutually exclusive.
 • This function is part of the LinearAlgebra package, and so it can be used in the form BackwardSubstitute(..) only after executing the command with(LinearAlgebra). However, it can always be accessed through the long form of the command by using LinearAlgebra[BackwardSubstitute](..).

Examples

 > $\mathrm{with}\left(\mathrm{LinearAlgebra}\right):$
 > $A≔⟨⟨1,0,0,0⟩|⟨0,1,0,0⟩|⟨2,-1,0,0⟩|⟨0,0,1,0⟩|⟨-2,1,-2,0⟩|⟨3,1,2,0⟩⟩$
 ${A}{:=}\left[\begin{array}{rrrrrr}{1}& {0}& {2}& {0}& {-}{2}& {3}\\ {0}& {1}& {-}{1}& {0}& {1}& {1}\\ {0}& {0}& {0}& {1}& {-}{2}& {2}\\ {0}& {0}& {0}& {0}& {0}& {0}\end{array}\right]$ (1)
 > $M≔\mathrm{BackwardSubstitute}\left(A\right)$
 ${M}{:=}\left[\begin{array}{c}{3}{-}{2}{}{{\mathrm{_t}}}_{{2}}{+}{2}{}{{\mathrm{_t}}}_{{1}}\\ {1}{+}{{\mathrm{_t}}}_{{2}}{-}{{\mathrm{_t}}}_{{1}}\\ {{\mathrm{_t}}}_{{2}}\\ {2}{+}{2}{}{{\mathrm{_t}}}_{{1}}\\ {{\mathrm{_t}}}_{{1}}\end{array}\right]$ (2)
 > ${A}_{1..-1,1..-2}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}.\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}M$
 $\left[\begin{array}{r}{3}\\ {1}\\ {2}\\ {0}\end{array}\right]$ (3)
 > $B≔⟨⟨1,0⟩|⟨0,1⟩|⟨0,1⟩|⟨0,1⟩⟩:$
 > $X≔⟨⟨1,-1⟩|⟨0,3⟩⟩:$
 > $\mathrm{ForwardSubstitute}\left(B,X,\mathrm{free}='x'\right)$
 $\left[\begin{array}{cc}{1}& {0}\\ {{x}}_{{1}{,}{1}}& {{x}}_{{1}{,}{2}}\\ {{x}}_{{2}{,}{1}}& {{x}}_{{2}{,}{2}}\\ {-}{1}{-}{{x}}_{{1}{,}{1}}{-}{{x}}_{{2}{,}{1}}& {3}{-}{{x}}_{{1}{,}{2}}{-}{{x}}_{{2}{,}{2}}\end{array}\right]$ (4)
 > $C≔⟨⟨1,0,0⟩|⟨0,1,0⟩|⟨1,1,1⟩⟩:$
 > $Y≔⟨3,2,4⟩:$
 > $\mathrm{BackwardSubstitute}\left(C,Y,\mathrm{inplace}\right)$
 $\left[\begin{array}{r}{-}{1}\\ {-}{2}\\ {4}\end{array}\right]$ (5)
 > $Y$
 $\left[\begin{array}{r}{-}{1}\\ {-}{2}\\ {4}\end{array}\right]$ (6)