News
Index
Working with MUMIE as author
- Initial steps:
- Articles:
- Problems:
- Programming with Python
- Visualizations with JSXGraph
- Media Documents:
Working with MUMIE as teacher
Using MUMIE via plugin in local LMS
FAQ
You're not logged in
Working with MUMIE as author
Working with MUMIE as teacher
Using MUMIE via plugin in local LMS
FAQ
To make a simple matrix variable you can use
\begin{variables}
...
\matrix{A}{
1 & 2 \\ %1st row of 2x2 matrix
3 & 4 %2nd row of 2x2 matrix
}
...
\end{variables}
you can also use number or function variables for the cells
\begin{variables}
\randint{a}{-5}{5}
\randint{b}{-5}{5}
\function[normalize]{c}{a+b}
\function[normalize]{d}{a-b}
\matrix{B}{
a & b \\ %1st row of 2x2 matrix
c & d %2nd row of 2x2 matrix
}
...
\end{variables}
The python like syntax is created to make create more complex matrices.
It supports matrix functions such as addition, multiplication, inverse and so on.
a matrix in the python like syntax is a collection of row vectors with same number of columns, separated by semicolon.
\begin{variables}
...
\matrix{C}{[ [1;2] ; [3;4] ]} % 2x2 Matrix
...
\end{variables}
you can also create row vector variables and use it in your matrix
\begin{variables}
...
\randint{a}{-5}{5}
\randint{b}{-5}{5}
\rowVector{row1}{[a;b]}
\matrix{C}{[ row1 ; [3;4] ]} % 2x2 Matrix
...
\end{variables}
Supported Matrix Operations are:
\begin{variables}
...
\matrix{C}{[ [1;2];[3;4] ]} % 2x2 Matrix
\matrix{D}{2*C} % Scalar multiplication
\matrix{E}{C*D} % Matrix multiplication
\matrix{F}{C.*D} % Hadamard product
\matrix{G}{C./D} % Hadamard division
\matrix{H}{D+E-C} % addition and substraction
\matrix{I}{inv(C)} % inverse of matrix, will throw exception if matrix is not invertible
\matrix{J}{transpose(C)} % adjoint of matrix
\matrix{K}{adjoint(C)} % adjoint of matrix
\matrix{L}{det(C)} % determinant of C, result is 1x1 matrix
\matrix{M}{trace(C)} % trace of C, result is 1x1 matrix
\function{fj}{det(C)} % determinant of C but as a function
\function{fk}{trace(C)} % trace of C but as a function
...
\end{variables}
The new syntax also supports function actions such as normalize, calculate, expand
\begin{variables}
...
\matrix{C}{[ [1;2];[3;4] ]} % 2x2 Matrix
\matrix{D}{C*2} % result is [ [2*1;2*2];[2*3;2*4] ]
\matrix[calculate]{Dcalc}{D} % result is [ [2;4] ; [6;8] ]
\end{variables}
...
See Matrix Algebra Example in Webmiau, or learn how to create input.matrix questions here
Indexing and slicing is zero based as in numpy. So the first row and the first column in a matrix have the index 0.
\begin{variables}
...
\matrix{C}{[ [1+x;2;3];[4;5;6] ]} % 2x3 Matrix
\matrix{D}{C[0,0]} % entry in the first row and first column as a 1x1 matrix
\function{fd}{C[0,0]} % entry in the first row and first column as a function object
...
\end{variables}
The Basic syntax for slicing is i:j:k, with
\begin{variables}
...
\matrix{C}{[ [1+x;2;3] ; [4;5;6] ]} % 2x3 Matrix
\matrix{D}{C[0:1,1:3]} % result is [ [2;3] ; [5;6] ]
\matrix{E}{C[1,0:3]} % result is [ [4;5;6] ]
\matrix{F]{C[:,0]} % result is the first column of all rows [ [1+x] ; [4] ]
\matrix{G}{C[1:]} % result is [ [4;5;6] ]
\matrix{H}{C[:,0:3:2] % result is [ [1+x;3] ; [4;6] ]
...
\end{variables}
See Indexing and Slicing Example in Webmiau, or learn how to create input.matrix questions here
Updated by Petrus Tan, 3 years ago – 2ffe6be