MxSolve
|
Matrix functions |
SYNTAX | MxSolve( A, B ) |
RETURNS | Matrix |
FUNCTION | The function solves linear equation system A@X = B.
A needs to be square matrix NxN Then calling X = MxSolve( A, B ); would give vertical vector holding solution of the system of equations A @ X = B B can also be a matrix,with each of its column representing different vector B. This way single call to MxSolve can solve several systems with same matrix A but different right hand vectors. If B is a matrix NxM then MxSolve will produce result also having NxM cells with each column representing single solution. (Highly) Technical note about numerical precision Despite the fact that both MxSolve and MxInverse use double precision arithmetic solving/inverting matrices is subject to numerical precision of double IEEE and for example zero result may come up as something like 1.4355e-16 (0.0000000000000001) due to the fact that double precision is still limited in accuracy (16 digits). The result of X = MxInverse( A ) @ B; although mathematically the same as solving the system of equations, would yield slightly different result because if you do the inverse the returned matrix is converted back to single precision and matrix product is performed with single precision. When you use MxSolve you are performing all calcs using 64-bit (double) precision and only end result is converted back to single precision. So for example polynomial fit code works better with MxSolve than MxInverse. |
EXAMPLE | // Example 1: |
SEE ALSO | Matrix() function , MxGetSize() function , MxIdentity() function , MxTranspose() function , MxToString() function |
The MxSolve function is used in the following formulas in AFL on-line library:
See updated/extended version on-line.