Matrix Answer

Answer is a matrix

Complete Code

Download file: MatrixAnswer1.pg

PG problem file

Explanation

DOCUMENT();

loadMacros('PGstandard.pl', 'PGML.pl', 'PGcourse.pl');

Preamble

These standard macros need to be loaded.
Context('Matrix');

$A = Matrix([
    [ random(-5, 5), random(-5, 5), random(-5, 5) ],
    [ random(-5, 5), random(-5, 5), random(-5, 5) ],
]);

$B = Matrix([
    [ random(-5, 5), random(-5, 5), random(-5, 5) ],
    [ random(-5, 5), random(-5, 5), random(-5, 5) ],
]);

$answer = $A * ($B->transpose);

Setup

Use Context('Matrix');. MathObject matrices are constructed using the Matrix() constructor. The matrix A has two rows and three columns, and is constructed by [[row 1 entries], [row 2 entries]], and this construction generalizes in the obvious way. If a matrix has only one row, such as B, then it is entered as [row 1 entries] and not as [ [row 1 entries] ]. If $B = Matrix([a,b,c]);, then the matrix $B->transpose is equivalent to Matrix([[a],[b],[c]]); which has an outer pair of brackets enclosing all of the rows, where each row encloses its single element with brackets.

BEGIN_PGML
Suppose

>> [``A = [$A]``] and [``B = [$B].``] <<

Evaluate the following matrix product.

[`A B^T =`] [_____]*{$answer}
END_PGML

Statement

This is the problem statement in PGML.
BEGIN_PGML_SOLUTION
Solution explanation goes here.
END_PGML_SOLUTION

ENDDOCUMENT();

Solution

A solution should be provided here.