# Value::Matrix class

References:

MathObject Matrix methods: http://webwork.maa.org/wiki/Matrix_(MathObject_Class) MathObject Contexts: http://webwork.maa.org/wiki/Common_Contexts CPAN RealMatrix docs: http://search.cpan.org/~leto/Math-MatrixReal-2.09/lib/Math/MatrixReal.pm

Allowing Matrices in Fractions: http://webwork.maa.org/moodle/mod/forum/discuss.php?d=2978

``     Context()->parens->set("[" => {formMatrix => 1});``

Files interacting with Matrices:

"MatrixReal1.pm" in lib

"MatrixReduce.pl" in macros

"Matrix.pm" in lib

"MatrixCheckers.pl" in macros -- checking whether vectors form a basis

"MatrixReduce.pl" in macros -- tools for row reduction via elementary matrices

"MatrixUnits.pl" in macros -- Generates unimodular matrices with real entries

"PGmatrixmacros.pl" in macros

"PGmorematrixmacros.pl" in macros

"PGnumericalmacros.pl" in macros

"tableau.pl" in macros

"quickMatrixEntry.pl" in macros

"LinearProgramming.pl" in macros

Contexts

``````        Matrix -- allows students to enter [[3,4],[3,6]]
-- formMatrix =>1 also allows this?
Complex-Matrix -- allows complex entries``````

Creation methods

``````                 \$M1 = Matrix([1,2],[3,4]);
\$M2 = Matrix([5,6],[7,8]);
\$v = Vector(9,10);
\$w = ColumnVector(9,10); # differs in how it is printed
``````

``````        Conversion
\$matrix->values produces [[3,4,5],[1,3,4]] recursive array references of numbers (not MathObjects)
\$matrix->wwMatrix   produces CPAN MatrixReal1 matrix, used for computation subroutines

Information
\$matrix->dimension:  ARRAY

Access values

row : MathObjectMatrix
column : MathObjectMatrix
element : Real or Complex value

Assign values

``````

see `change_matrix_entry()` in MatrixReduce and http://webwork.maa.org/moodle/mod/forum/discuss.php?d=2970

``````        Advanced
\$matrix->data:  ARRAY reference (internal data) of MathObjects (Real,Complex, Fractions)
stored at each location.``````

Passthrough methods covering subroutines in Matrix.pm which overrides or augment CPAN's MatrixReal1.pm. Matrix is a specialized subclass of MatrixReal1.pm

The actual calculations for these methods are done in `pg/lib/Matrix.pm`

``````        trace
proj
proj_coeff
L
R
PL
PR``````

Passthrough methods covering subroutines in `pg/lib/MatrixReal1.pm` (this has been modified to handle complex numbers) The actual calculations are done in `MatrixReal1.pm` subroutines The commands below are Value::Matrix methods unless otherwise noted.

``````        condition
det
inverse
is_symmetric
decompose_LR
dim
norm_one
norm_max
kleene
normalize
solve_LR(\$v)    - LR decomposition
solve(\$M,\$v)    - function version of solve_LR
order_LR        - order of LR decomposition matrix (number of non-zero equations)(also order() )
order(\$M)       - function version of order_LR
solve_GSM
solve_SSM
solve_RM
``````