Matrix calculations 



A matrix consists of a two dimensional array of numbers, arranged in rows and columns. Matrices can be manipulated like numbers except they have special multiplication and division properties. Formula calculator enables you to create matrices, will perform matrix multplications, divisions, additions and subtractions, as well as allowing matrices to be used as parameters in functions. 

Creating a matrix: A matrix is created using the function matrix(nr,nc, m_{11},m_{12}, ..., m_{1nc}, m_{21}, m_{22} .... m_{nr nc}) where nr is an integer specifying the numbers of rows in the matrix and nc is an integer specifying the number of columns. Following these parameters is a list of the elements of the matrix separated by commas. The list must have nr*nc elements. For example a 3x2 matrix 

would be specifed by myMatrix=matrix(3,2,0,2,1,3,4,6) 

The matrix elements can be real or complex numbers, parameters, arrays of numbers (see ranges) or even other matrices. 

Viewing matrix elements: Since matrices may contain many numbers, formula calculator does not show you the matrix contents, but lets you know the parameter is a matrix. For the above example we would see myMatrix=<matrix>. You can view the matrix values by clicking the 'hide matrix' label near the top of the formula calculator window. Also you can access matrix elements using the element(myMatrix,n,m) function that returns the element of the matrix at row n and column m. 

Matrix operations: Formula calculator performs the usual matrix operations of addition, subtraction, multiplication and division. Division is performed by multplying by the matrix inverse. A matrix inverse is only possible for square matrices, where the number of rows equals the number of columns. If the function or an operation is between a matrix and a single number, then formula calculator applies the operation to each element of the matrix. For example, myMatrix+2 would add 2 to every element in the matrix and myMatrix*2 multiplies every element by 2. Matrix inversion is then very simple. The expression inv=1/matrix causes formula calculator to invert the matrix and multiply the result by 1, assigning the result to inv. If a matrix parameter is the argument of a nonmatrix function, then the function is applied to every element of the matrix. For example, sin(myMatrix) would take the sine of each element in the matrix and return the result as another matrix. 

Matrix functions: Other special matrix functions are:

