Permalink
Fetching contributors…
Cannot retrieve contributors at this time
68 lines (63 sloc) 2.4 KB
<!DOCTYPE html>
<html data-require="math kmatrix qhints">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Matrix dimensions</title>
<script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
<div class="vars" data-ensure="!(DIM_1 === 1 &amp;&amp; DIM_2 === 1)">
<var id="DIM_1">randRange(1, 4)</var>
<var id="DIM_2">randRange(1, 4)</var>
<var id="MAT_A">makeMatrix(randRange(-2, 4, DIM_1, DIM_2))</var>
<var id="PRETTY_MAT_ID">"\\textbf " + randFromArray("ABCDEF")</var>
<var id="PRETTY_MAT_A">
printSimpleMatrix(MAT_A)
</var>
</div>
<div class="problems">
<div>
<div class="problem">
<p>
<code><var>PRETTY_MAT_ID</var> = <var>PRETTY_MAT_A</var></code>
</p>
</div>
<p class="question">
What are the dimensions of matrix <code><var>PRETTY_MAT_ID</var></code>?
</p>
<div class="solution" data-type="multiple">
<span class="sol short40" data-forms="integer"><var>DIM_1</var></span>
<code>\times</code>
<span class="sol short40" data-forms="integer"><var>DIM_2</var></span>
</div>
</div>
</div>
<div class="hints">
<div class="qhint">
<p>
The first dimension is the number of rows in the matrix. How many rows does <code><var>PRETTY_MAT_ID</var></code> have?
</p>
<span class="qhint-answer"><var>DIM_1</var></span>
<p class="qhint-input">
<input type="text" value="">
<input type="submit" value="Check">
</p>
</div>
<div class="qhint">
<p>
The second dimension is the number of columns in the matrix. How many columns does <code><var>PRETTY_MAT_ID</var></code> have?
</p>
<span class="qhint-answer"><var>DIM_2</var></span>
<p class="qhint-input">
<input type="text" value="">
<input type="submit" value="Check">
</p>
</div>
<div>
So, <code><var>PRETTY_MAT_ID</var></code> is a <var>DIM_1</var> <code>\times</code> <var>DIM_2</var> matrix.
</div>
</div>
</div>
</body>
</html>