You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improvements to `aug` following suggestions from Marc Peterfi. The function behaves as it previously did when given a single matrix (that is, it will insert a vertical bar before the final column), but when given two or more matrices as arguments it will concatenate them with vertical bars between each.
The original use case is to generate worked solutions for matrix inversion or similar, e.g. aug(A, ident(3)) → aug(rowop(A,2,1,A[2,1]/A[1,1]), rowop(ident(3),2,1,A[2,1]/A[1,1]) but could be used for more.
aug(addcol(A,b)) and aug(A,b) are identical.
Existing test cases will fail only because the vertical bar is now generated as a closing bracket instead of an opening one. This looks nicer, so I am treating this as a feature instead of a bug.
* aug_matrix is an inert function that is used for displaying a matrix as an augmented matrix
49
52
* To convert back, use de_aug
50
53
*
51
-
* @param[matrix] M The matrix you would like to display as an augmented matrix
54
+
* @param[matrix] M The matrix or matrices you would like to display as an augmented matrix
52
55
* @return[aug_matrix] An augmented matrix
53
56
*/
54
-
aug(M):= apply(aug_matrix,args(M));
57
+
aug([M]):= if is(length(M)=1) then apply(aug_matrix,[submatrix(first(M),second(matrix_size(first(M)))),col(first(M),second(matrix_size(first(M))))]) else apply(aug_matrix,M);
55
58
56
59
/**
57
60
* Converts an aug_matrix to a matrix
58
61
* aug_matrix is an inert function that is used for displaying a matrix as an augmented matrix
62
+
* Note: This always returns a single matrix constructed by concatenating the arguments of the original aug_matrix.
59
63
*
60
64
* @param[matrix] M The aug_matrix you would like to treat as a regular matrix
0 commit comments