<?xml version="1.0" encoding="UTF-8"?>
<quiz>
  <question type="stack">
    <name>
      <text>9.3.16 (Partial fractions 1lin 1quad 2)</text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>The goal of this question is to find the partial fraction decomposition of&nbsp;\(\dfrac{@ratFnNum@}{@ratFnDen@}\).</p>
<p><b>(a) </b>Write the <b>form</b> of the partial fraction decomposition, using constants A, B, C in your answer.<br></p>
[[input:ans1]][[validation:ans1]][[feedback:prt1]]
<p></p>
<p><b>(b) </b>Write in the system of equations that the constants satisfy. Write each equation on a new line.</p>
[[input:ans2]][[validation:ans2]][[feedback:prt2]]
<p><b>(c) </b>What are the values of the constants? Enter your answer as a list, e.g. <code>[A=1,B=2]</code>.</p>
[[input:ans3]][[validation:ans3]][[feedback:prt3]]]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text><![CDATA[<p><b>(a) </b>The correct form is \(\displaystyle{@partialFractionsForm@}\).</p><p><b>(b) </b>Putting everything in terms of the common denominator {@ratFnDen@},</p><p>\[ {@ratFn@} = \frac{{@numForm@}}{{@ratFnDen@}} \]</p><p>In particular, the numerators must be equal:</p><p>\[ {@ratFnNum@} = {@numForm@} \]</p><p>From this we can find equations in \(A, B, C\).</p><p>One approach is to evaluate the numerators at specific values of \(x\):</p><p>\[\begin{align*} x&amp;={@a@} \text{ gives}\quad &amp; {@lhs(ta2[1])@} &amp;= {@rhs(ta2[1])@} \\&nbsp;x&amp;={@b@} \text{ gives}\quad &amp; {@lhs(ta2[2])@} &amp;= {@rhs(ta2[2])@} \\&nbsp;x&amp;={@0@} \text{ gives}\quad &amp; {@lhs(ta2[3])@} &amp;= {@rhs(ta2[3])@} \end{align*}\]</p><p>An alternative approach is to expand out the numerators and compare coefficients:</p><p>\[ {@ratFnNum@} = {@(expandedNumForm),simp=false@} \]</p><p>\[\begin{align*} &amp;x^2 \text{ gives}\quad &amp; {@lhs(altEqns[1])@} &amp;= {@rhs(altEqns[1])@} \\ &amp;x^1 \text{ gives}\quad &amp; {@lhs(altEqns[2])@} &amp;= {@rhs(altEqns[2])@} \\ &amp;x^0 \text{ gives}\quad &amp;{@lhs(altEqns[3])@} &amp;= {@rhs(altEqns[3])@}&nbsp;\end{align*}\]<br></p><p><b>(c) </b>Regardless of which system we use, the solution should be the same:</p><p>\[\begin{align*} {@lhs(ta3[1])@} &amp;= {@rhs(ta3[1])@} \\&nbsp; {@lhs(ta3[2])@} &amp;= {@rhs(ta3[2])@} \\ {@lhs(ta3[3])@} &amp;= {@rhs(ta3[3])@} &nbsp;\end{align*}\]</p><p>So \[ {@ratFn@} = {@partialFractions@}. \]</p>]]></text>
    </generalfeedback>
    <defaultgrade>1</defaultgrade>
    <penalty>0.1</penalty>
    <hidden>0</hidden>
    <idnumber/>
    <stackversion>
      <text>2024072400</text>
    </stackversion>
    <questionvariables>
      <text><![CDATA[ordergreat(A,B,C);
denRoots:rand([[-5,-2],[-5,2],[-5,5],[-4,-1],[-4,3],[-3,-2],[-3,2],[-3,5],[-2,2],[-2,5],[-1,3],[1,2],[1,5],[2,5],[4,5]]);
a:denRoots[1];
b:denRoots[2];
partialFractionsForm:A/(x-a)+B/(x-b)+C/(x-b)^2;
numForm:A*(x-b)^2+B*(x-a)*(x-b)+C*(x-a);
expandedNumFormTerms:maplist(lambda([ex],coeff(expand(numForm),x,ex)*x^ex),[2,1,0]);
expandedNumForm:(simp:false,apply("+",expandedNumFormTerms));
simp:true;
A1:rand_with_prohib(-5,5,[0]);
B1:rand_with_prohib(-5,5,[0,A1,-A1]);
C1:rand_with_prohib(-5,5,[0,A1,-A1,B1,-B1]);
partialFractions:ev(partialFractionsForm,[A=A1,B=B1,C=C1]);
ratFnNum:ev(expand(A*(x-b)^2+B*(x-a)*(x-b)+C*(x-a)),[A=A1,B=B1,C=C1]); /* or: num(ratsimp(partialFractions)); */
ratFnDen:(x-a)*(x-b)^2;
ratFn:ratFnNum/ratFnDen;
ta1:partialFractionsForm;
ta2:maplist(lambda([ex],ev(numForm,[x=ex])=ev(ratFnNum,[x=ex])),[a,b,0]);
altEqns:maplist(lambda([ex],coeff(expand(numForm),x,ex)=coeff(expand(ratFnNum),x,ex)),[2,1,0]);
ta3:[A=A1,B=B1,C=C1];]]></text>
    </questionvariables>
    <specificfeedback format="html">
      <text/>
    </specificfeedback>
    <questionnote format="moodle_auto_format">
      <text>{@ratFn=partialFractionsForm@}, {@ta3@}</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>none</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>algebraic</type>
      <tans>ta1</tans>
      <boxsize>20</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>1</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options/>
    </input>
    <input>
      <name>ans2</name>
      <type>textarea</type>
      <tans>ta2</tans>
      <boxsize>30</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>5</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>1</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options/>
    </input>
    <input>
      <name>ans3</name>
      <type>algebraic</type>
      <tans>ta3</tans>
      <boxsize>15</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>5</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <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>SubstEquiv</answertest>
        <sans>ans1</sans>
        <tans>ta1</tans>
        <testoptions>[x]</testoptions>
        <quiet>1</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt1-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt1-1-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>/* (1) solve their system of equations for A,B,C  (2) plug those values into ans1  (3) check that this gives RatFn */
theirsols:solve(ans2,[A,B,C]);
whatthatgives:ev(ans1,theirsols);</text>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>whatthatgives</sans>
        <tans>ratFn</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt2-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt2-1-F</falseanswernote>
        <falsefeedback format="html">
          <text><![CDATA[<p>Your system of equations does not fit with the form you gave in the previous answer.</p>]]></text>
        </falsefeedback>
      </node>
    </prt>
    <prt>
      <name>prt3</name>
      <value>1.0000000</value>
      <autosimplify>1</autosimplify>
      <feedbackstyle>1</feedbackstyle>
      <feedbackvariables>
        <text>theirsols2:solve(ans2,[A,B,C])[1];</text>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>setify(ans3)</sans>
        <tans>setify(theirsols2)</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>0.5</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt3-1-T</trueanswernote>
        <truefeedback format="html">
          <text><![CDATA[<p dir="ltr" style="text-align: left;">You did correctly solve your system of equations.</p>]]></text>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt3-1-F</falseanswernote>
        <falsefeedback format="html">
          <text><![CDATA[<p>This is not the solution to the system of equations you gave above. In fact, the solution is {@theirsols2@}.</p>]]></text>
        </falsefeedback>
      </node>
      <node>
        <name>1</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ev(ans1,ans3)</sans>
        <tans>ratFn</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt3-2-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>-</falsescoremode>
        <falsescore>0</falsescore>
        <falsepenalty/>
        <falsenextnode>0</falsenextnode>
        <falseanswernote>prt3-2-F</falseanswernote>
        <falsefeedback format="html">
          <text><![CDATA[<p>Putting these values of \(A, B, C\) into your expression in part (a) does not give the correct partial fractions decomposition.</p>]]></text>
        </falsefeedback>
      </node>
    </prt>
    <deployedseed>1272666516</deployedseed>
    <deployedseed>1966175250</deployedseed>
    <deployedseed>1103577394</deployedseed>
    <deployedseed>687393699</deployedseed>
    <deployedseed>74724440</deployedseed>
    <deployedseed>1218240614</deployedseed>
    <deployedseed>236823031</deployedseed>
    <deployedseed>2131724599</deployedseed>
    <deployedseed>553550029</deployedseed>
    <deployedseed>1321329856</deployedseed>
    <deployedseed>1142400940</deployedseed>
    <deployedseed>303968471</deployedseed>
    <deployedseed>353366256</deployedseed>
    <deployedseed>1317160110</deployedseed>
    <deployedseed>317545338</deployedseed>
    <deployedseed>1130804191</deployedseed>
    <deployedseed>365492561</deployedseed>
    <deployedseed>1788533868</deployedseed>
    <deployedseed>737222831</deployedseed>
    <deployedseed>1948921412</deployedseed>
    <deployedseed>932923052</deployedseed>
    <deployedseed>115799319</deployedseed>
    <deployedseed>899856265</deployedseed>
    <deployedseed>737474728</deployedseed>
    <deployedseed>1891084305</deployedseed>
    <deployedseed>1866676073</deployedseed>
    <deployedseed>1117278032</deployedseed>
    <deployedseed>1338317324</deployedseed>
    <deployedseed>1721639703</deployedseed>
    <deployedseed>352478703</deployedseed>
    <deployedseed>475100608</deployedseed>
    <deployedseed>107230661</deployedseed>
    <deployedseed>125662022</deployedseed>
    <deployedseed>2024146087</deployedseed>
    <deployedseed>1209611989</deployedseed>
    <deployedseed>1895402282</deployedseed>
    <deployedseed>669959820</deployedseed>
    <deployedseed>825012424</deployedseed>
    <deployedseed>1603976717</deployedseed>
    <deployedseed>546328131</deployedseed>
    <deployedseed>1054102605</deployedseed>
    <deployedseed>1524554704</deployedseed>
    <deployedseed>1405714737</deployedseed>
    <deployedseed>418309778</deployedseed>
    <deployedseed>1845261048</deployedseed>
    <deployedseed>1748181395</deployedseed>
    <deployedseed>1600045092</deployedseed>
    <deployedseed>1954276245</deployedseed>
    <qtest>
      <testcase>1</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>ta1</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>ta2</value>
      </testinput>
      <testinput>
        <name>ans3</name>
        <value>ta3</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-2-T</expectedanswernote>
      </expected>
    </qtest>
    <qtest>
      <testcase>2</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>ta1</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>altEqns</value>
      </testinput>
      <testinput>
        <name>ans3</name>
        <value>ta3</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-2-T</expectedanswernote>
      </expected>
    </qtest>
    <qtest>
      <testcase>3</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>ev(ta1,[A=B,B=A])</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>[A=1,B=1,C=1]</value>
      </testinput>
      <testinput>
        <name>ans3</name>
        <value>[A=1,B=1,C=1]</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>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>prt2-1-F</expectedanswernote>
      </expected>
      <expected>
        <name>prt3</name>
        <expectedscore>0.5000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>prt3-1-T</expectedanswernote>
      </expected>
    </qtest>
    <qtest>
      <testcase>4</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>ta1</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>ta2</value>
      </testinput>
      <testinput>
        <name>ans3</name>
        <value>random_permutation(ta3)</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-2-T</expectedanswernote>
      </expected>
    </qtest>
    <qtest>
      <testcase>5</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value><![CDATA[apply("+",random_permutation(args(ta1)))]]></value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value/>
      </testinput>
      <testinput>
        <name>ans3</name>
        <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/>
        <expectedpenalty/>
        <expectedanswernote>NULL</expectedanswernote>
      </expected>
      <expected>
        <name>prt3</name>
        <expectedscore/>
        <expectedpenalty/>
        <expectedanswernote>NULL</expectedanswernote>
      </expected>
    </qtest>
  </question>
</quiz>
