student::equateMatrix
--
build a matrix equationstudent::equateMatrix(
A, vars)
returns the
matrix equation
A[1..r,1..c-1] * vars
= A[1..r,c..c]
student::equateMatrix(A, vars)
A |
- | matrix (of category Cat::Matrix ) over a Cat::Field |
vars |
- | list of indeterminates |
an expression of the domain type DOM_EXPR
and of type
"equal"
.
student::equateMatrix
(A
,vars
)
returns the matrix equation
A[1..r,1..c-1] * X = A[1..r,c..c]where r and c are the row and column number of
A
, and x_1, ..., x_r are the elements of
vars
.vars
must match
the row number of the matrix A
.Let us construct the equation A*X=b. First we construct A and b:
>> Ab := matrix( [[1,2,3],[-1,3,0]] )
+- -+ | 1, 2, 3 | | | | -1, 3, 0 | +- -+
Here we have A = [[1,2],[-1,3]] and b = [3,0]. Now we construct the equation A*X=b:
>> student::equateMatrix( Ab,[x1,x2] )
+- -+ +- -+ | x1 + 2 x2 | | 3 | | | = | | | - x1 + 3 x2 | | 0 | +- -+ +- -+
We should be carefull to use the right dimension of the matrix and the indeterminates:
>> Ab := matrix( [[1,2,3],[-1,3,0]] )
+- -+ | 1, 2, 3 | | | | -1, 3, 0 | +- -+
>> student::equateMatrix( Ab,[x1,x2,x3] )
Error: dimension of matrix and number of vars don't match [stu\ dent::equateMatrix]