Permalink
Fetching contributors…
Cannot retrieve contributors at this time
98 lines (85 sloc) 2.89 KB
<!DOCTYPE html>
<html data-require="math kmatrix matrix-input">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Matrix transpose</title>
<script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
<div class="vars">
<var id="MAT">makeMatrix(randRange(0, 9, DIM_1, DIM_2))</var>
<var id="SOLN_MAT">matrixTranspose(MAT)</var>
<var id="PADDED_SOLN_MAT">matrixPad(SOLN_MAT, 3, 3)</var>
<var id="PRETTY_MAT_ID">"\\textbf " + randFromArray("ABCDEF")</var>
<var id="PRETTY_SOLN_MAT">printSimpleMatrix(SOLN_MAT)</var>
</div>
<div class="problem">
<p>
<code><var>PRETTY_MAT_ID</var> = <var>printSimpleMatrix(MAT)</var></code>
</p>
</div>
<p class="question">
What is <code><var>PRETTY_MAT_ID</var>^{T}</code>?
</p>
<div class="hints">
<p>
To find the transpose, swap the rows and columns.
</p>
<p>
<code><var>PRETTY_MAT_ID</var>^{T}</code> = <code><var>PRETTY_SOLN_MAT</var></code>
</p>
</div>
<div class="solution" data-type="multiple">
<div class="matrix-row" data-each="PADDED_SOLN_MAT as row">
<span data-each="row as elem">
<span class="sol" data-forms="integer" data-if="elem !== ''">
<var>elem</var>
</span>
<span class="sol" data-else="" data-type="text">
<var>elem</var>
</span>
</span>
</div>
</div>
<div class="problems">
<div id="1x2" data-weight="1">
<div class="vars" data-apply="prependVars">
<var id="DIM_1">1</var>
<var id="DIM_2">2</var>
</div>
</div>
<div id="2x2" data-weight="2">
<div class="vars" data-apply="prependVars">
<var id="DIM_1">2</var>
<var id="DIM_2">2</var>
</div>
</div>
<div id="2x3" data-weight="2">
<div class="vars" data-apply="prependVars">
<var id="DIM_1">2</var>
<var id="DIM_2">3</var>
</div>
</div>
<div id="3x1" data-weight="1">
<div class="vars" data-apply="prependVars">
<var id="DIM_1">3</var>
<var id="DIM_2">1</var>
</div>
</div>
<div id="3x2" data-weight="2">
<div class="vars" data-apply="prependVars">
<var id="DIM_1">3</var>
<var id="DIM_2">2</var>
</div>
</div>
<div id="3x3" data-weight="2">
<div class="vars" data-apply="prependVars">
<var id="DIM_1">3</var>
<var id="DIM_2">3</var>
</div>
</div>
</div>
</div>
</body>
</html>