Matrix Assignments
Date: 2020-10-07 18:10:00

Up | Next | Prev | PrevTail | Tail

### 14.5 Matrix Assignments

Matrix expressions may appear in the right-hand side of assignment statements. If the left-hand side of the assignment, which must be a variable, has not already been declared a matrix, it is declared by default to the size of the right-hand side. The variable is then set to the value of the right-hand side.

Such an assignment may be used very conveniently to ﬁnd the solution of a set of linear equations. For example, to ﬁnd the solution of the following set of equations

a11*x(1) + a12*x(2) = y1
a21*x(1) + a22*x(2) = y2

we simply write

x := 1/mat((a11,a12),(a21,a22))*mat((y1),(y2));

Up | Next | Prev | PrevTail | Front