<?xml version="1.0" encoding="UTF-8"?>
<quiz>
  <question type="stack">
    <name>
      <text>22.2.1.2 Writing down products</text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p class="HELM_exercise">Exercise</p>
<p>The matrix <span class="math inline">\({@matA@}\)</span> has eigenvalues <span class="math inline">\({@eval1@}\)</span> and <span class="math inline">\({@eval2@}\)</span> with respective eigenvectors&nbsp;&nbsp;<span class="math inline">\({@evec1@}\)</span> and <span class="math inline">\({@evec2@}\)</span>.
<br>
If \( P_1={@p1@}, \

P_2={@p2@}\) and

\( P_3={@p3@},\) write down the following products (You may not need to do detailed calculations).</p>
<ol class="HELM_parts">
<li>
<div>\(P_1^{-1}AP_1=\) [[input:ans1]] [[validation:ans1]][[feedback:prt1]]</div></li><div>
<br></div>

<li>
<div>\(P_2^{-1}AP_2=\) [[input:ans2]] [[validation:ans2]][[feedback:prt2]]</div></li><div><br></div>
<li>
<div>\(P_3^{-1}AP_3=\) [[input:ans3]] [[validation:ans3]][[feedback:prt3]]</div></li><div><br></div>
</ol>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text><![CDATA[<p>Since \(P_1,P_2\) and \(P_3\) are all modal matrices of \(A\),
<br>\(\qquad P_1^{-1}AP_1={@matD@}= {@matD@} = D_1\)
<br>\(\qquad P_2^{-1}AP_2={@matD2@}= {@matD2@} = D_2\)
<br>\(\qquad P_3^{-1}AP_3={@matD@}= {@matD@}= D_3\)
<br>Note that <span class="math inline">\(D_1=D_3,\)</span> demonstrating that any eigenvectors of <span class="math inline">\(A\)</span> can be used to form <span class="math inline">\(P\)</span>. Note also that since the columns of <span class="math inline">\(P_1\)</span> have been interchanged in forming <span class="math inline">\(P_2\)</span> then so have the eigenvalues in <span class="math inline">\(D_2\)</span> as compared with <span class="math inline">\(D_1\)</span>.</p>]]></text>
    </generalfeedback>
    <defaultgrade>1</defaultgrade>
    <penalty>0.1</penalty>
    <hidden>0</hidden>
    <idnumber/>
    <stackversion>
      <text>2021072200</text>
    </stackversion>
    <questionvariables>
      <text><![CDATA[/*I decided not to tackle this question by generating a random matrix, as that would result in "ugly" evals and evecs. Instead I randomly generate evals and evecs and create the matrix A from them. Unsightly A matrices and question variations with duplicate evecs should be removed manually.
*/

evec1:rand(matrix([4],[4]))+matrix([1],[0])
evec2:rand(matrix([4],[4]))+matrix([0],[1])

eval1:rand_with_prohib(-4,4,[0])
eval2:rand_with_prohib(-4,4,[0])

/*deduce the matrix A*/
p1:matrix([evec1[1,1],evec2[1,1]],[evec1[2,1],evec2[2,1]])
p1inv:invert(p1)
matD:matrix([eval1,0],[0,eval2])
matA:p1.matD.p1inv

/*Create similar diagonal matrices */
constant:rand(3)+2
matD2:matrix([eval2,0],[0,eval1])
constmatD:constant*matD

/*modular matrices related to similar diagonl matrices*/
p2:matrix([evec2[1,1],evec1[1,1]],[evec2[2,1],evec1[2,1]])
p3:constant*p1]]></text>
    </questionvariables>
    <specificfeedback format="html">
      <text/>
    </specificfeedback>
    <questionnote format="moodle_auto_format">
      <text>Evecs: \({@evec1@}, {@evec2@}\)
Evals: \({@eval1@},{@eval2@}\)
\(A: {@matA@}\)
Constant: \({@constant@}\)
\(P_1={@p1@}\)
\(P_2={@p2@}\)
\(P_3={@p3@}\)</text>
    </questionnote>
    <questiondescription format="moodle_auto_format">
      <text/>
    </questiondescription>
    <questionsimplify>1</questionsimplify>
    <assumepositive>0</assumepositive>
    <assumereal>0</assumereal>
    <prtcorrect format="html">
      <text><![CDATA[<span style="font-size: 1.5em; color:green;"><i class="fa fa-check"></i></span> Correct answer, well done.]]></text>
    </prtcorrect>
    <prtpartiallycorrect format="html">
      <text><![CDATA[<span style="font-size: 1.5em; color:orange;"><i class="fa fa-adjust"></i></span> Your answer is partially correct.]]></text>
    </prtpartiallycorrect>
    <prtincorrect format="html">
      <text><![CDATA[<span style="font-size: 1.5em; color:red;"><i class="fa fa-times"></i></span> Incorrect answer.]]></text>
    </prtincorrect>
    <decimals>.</decimals>
    <scientificnotation>*10</scientificnotation>
    <multiplicationsign>dot</multiplicationsign>
    <sqrtsign>1</sqrtsign>
    <complexno>i</complexno>
    <inversetrig>cos-1</inversetrig>
    <logicsymbol>lang</logicsymbol>
    <matrixparens>[</matrixparens>
    <isbroken>0</isbroken>
    <variantsselectionseed/>
    <input>
      <name>ans1</name>
      <type>matrix</type>
      <tans>matD</tans>
      <boxsize>3</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords>., invert</forbidwords>
      <allowwords/>
      <forbidfloat>1</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options/>
    </input>
    <input>
      <name>ans2</name>
      <type>matrix</type>
      <tans>matD2</tans>
      <boxsize>3</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords>., invert</forbidwords>
      <allowwords/>
      <forbidfloat>1</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options/>
    </input>
    <input>
      <name>ans3</name>
      <type>matrix</type>
      <tans>matD</tans>
      <boxsize>3</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords>., invert</forbidwords>
      <allowwords/>
      <forbidfloat>1</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options/>
    </input>
    <prt>
      <name>prt1</name>
      <value>1.0000000</value>
      <autosimplify>1</autosimplify>
      <feedbackstyle>1</feedbackstyle>
      <feedbackvariables>
        <text/>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans1</sans>
        <tans>matD</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt1-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>1</falsenextnode>
        <falseanswernote>prt1-1-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
      <node>
        <name>1</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans1</sans>
        <tans>matD2</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>+</truescoremode>
        <truescore>0.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt1-2-T</trueanswernote>
        <truefeedback format="html">
          <text>Remember that \({@evec1@}\) has associated eigenvalue \({@eval1@}\) and \({@evec2@}\) has associated eigenvalue \({@eval2@}\), not the other way around!</text>
        </truefeedback>
        <falsescoremode>-</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt1-2-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <prt>
      <name>prt2</name>
      <value>1.0000000</value>
      <autosimplify>1</autosimplify>
      <feedbackstyle>1</feedbackstyle>
      <feedbackvariables>
        <text/>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans2</sans>
        <tans>matD2</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt2-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>1</falsenextnode>
        <falseanswernote>prt2-1-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
      <node>
        <name>1</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans2</sans>
        <tans>matD</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>+</truescoremode>
        <truescore>0.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt2-2-T</trueanswernote>
        <truefeedback format="html">
          <text>Remember that \({@evec1@}\) has associated eigenvalue \({@eval1@}\) and \({@evec2@}\) has associated eigenvalue \({@eval2@}\), not the other way around!</text>
        </truefeedback>
        <falsescoremode>-</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt2-2-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <prt>
      <name>prt3</name>
      <value>1.0000000</value>
      <autosimplify>1</autosimplify>
      <feedbackstyle>1</feedbackstyle>
      <feedbackvariables>
        <text/>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans3</sans>
        <tans>matD</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt3-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>1</falsenextnode>
        <falseanswernote>prt3-1-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
      <node>
        <name>1</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans3</sans>
        <tans>constmatD</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>+</truescoremode>
        <truescore>0.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt3-2-T</trueanswernote>
        <truefeedback format="html">
          <text>It seems your intuition was to multiply \(P_1^{-1}AP_1\) by \({@constant@}\), but that is incorrect! Try doing the Matrix multiplication manually to convince yourself.</text>
        </truefeedback>
        <falsescoremode>-</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt3-2-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <deployedseed>1767076597</deployedseed>
    <deployedseed>1634817021</deployedseed>
    <deployedseed>170397530</deployedseed>
    <deployedseed>1973883475</deployedseed>
    <deployedseed>178030172</deployedseed>
    <deployedseed>1331139091</deployedseed>
    <deployedseed>1240835568</deployedseed>
    <deployedseed>1354191285</deployedseed>
    <deployedseed>458327123</deployedseed>
    <deployedseed>1576040320</deployedseed>
    <deployedseed>2050043352</deployedseed>
    <deployedseed>337635763</deployedseed>
    <deployedseed>2091769531</deployedseed>
    <deployedseed>615668983</deployedseed>
    <qtest>
      <testcase>1</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>matD</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>matD2</value>
      </testinput>
      <testinput>
        <name>ans3</name>
        <value>matD</value>
      </testinput>
      <expected>
        <name>prt1</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt1-1-T</expectedanswernote>
      </expected>
      <expected>
        <name>prt2</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt2-1-T</expectedanswernote>
      </expected>
      <expected>
        <name>prt3</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt3-1-T</expectedanswernote>
      </expected>
    </qtest>
    <qtest>
      <testcase>2</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>matD2</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>matD</value>
      </testinput>
      <testinput>
        <name>ans3</name>
        <value>constmatD</value>
      </testinput>
      <expected>
        <name>prt1</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>prt1-2-T</expectedanswernote>
      </expected>
      <expected>
        <name>prt2</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>prt2-2-T</expectedanswernote>
      </expected>
      <expected>
        <name>prt3</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>prt3-2-T</expectedanswernote>
      </expected>
    </qtest>
  </question>
</quiz>
