Top
Back: luinverse
Forward: maxideal
FastBack: Functions and system variables
FastForward: Control structures
Up: Functions
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

5.1.77 lusolve

Syntax:
lusolve ( matrix_expression, matrix_expression, matrix_expression, matrix_expression )
Type:
matrix
Purpose:
Computes a solution of a linear equation system A*x = b, if solvable

The (m x n matrix A must be given by its LU-decomposition, that is, by three matrices P, L, and U, in this order, which satisfy
- P * A = L * U,
- P is an (m x m) permutation matrix, i.e., its rows/columns form the standard basis of K^m,
- L is an (m x m) matrix in lower triangular form with all diagonal entries equal to 1, and
- U is an (m x n) matrix in upper row echelon form.
The fourth argument, b, is expected to be an (m x 1) matrix, i.e., a vector.

list L=lusolve(P,L,U,b); fills the list L with either one entry = 0 (signaling that A*x=b has no solution), or with the three entries 1, x, d, where x is any (n x 1) solution and d the dimension of the affine solution space.

Note:
The method will give a warning if the matrices violate the above conditions regarding row and column numbers, or if the number of rows of the vector b does not equal m.

Example:
 
  ring r=0,(x),dp;
  matrix A[4][3]=1,1,3,2,1,4,3,0,3,4,0,4;
  matrix b[4][1]=5,7,6,8;
  list L=ludecomp(A);
  list Q=lusolve(L[1],L[2],L[3],b);
  if (Q[1] == 1)
  {
    print(Q[2]);
    "----- next should be the zero vector:";
    print(A*Q[2]-b);
    "solution space has dimension", Q[3];
  }
==> 2,
==> 3,
==> 0 
==> ----- next should be the zero vector:
==> 0,
==> 0,
==> 0,
==> 0 
==> solution space has dimension 1
See ludecomp.

Top Back: luinverse Forward: maxideal FastBack: Functions and system variables FastForward: Control structures Up: Functions Top: Singular Manual Contents: Table of Contents Index: Index About: About this document
            User manual for Singular version 3-1-1, Feb 2010, generated by texi2html.