<?xml version="1.0" encoding="UTF-8"?>
<quiz>
  <question type="stack">
    <name>
      <text>8.2.17 (How many terms? Hence eval)</text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p><b>(a) </b>How many terms are in the sum \({@u1@}+{@u2@}+{@u3@}+\cdots+{@u_fin@}\)?</p><p>&nbsp; &nbsp; [[input:ans1]][[feedback:prt1]] [[validation:ans1]]</p><p><b>(b) </b>Hence, what is the value of the sum?</p><p>&nbsp; &nbsp; [[input:ans2]][[feedback:prt2]] [[validation:ans2]]</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text><![CDATA[<p><b>(a) </b>We are given the sum \({@u1@}+{@u2@}+{@u3@}+\cdots+{@u_fin@}.\)<br></p><p>To get from {@u1@} to {@u_fin@} we have added a total of \({@u_fin@}-{@u1@}={@u_fin-u1@}\), which is \({@(u_fin-u1)/d@}\times{@d@}\). So we have added the common difference \(d\) a total of {@n_val-1@} times, meaning we have {@n_val@} terms overall.</p><p><p>An alternative way to find the number of terms is to notice that \( a= {@a1@}\) and \( d = {@d@}.\)</p><p>We know that \( u_n= a+(n-1)d\) so \( {@u_fin@} = {@a1@}+(n-1){@d@}\), giving \(n= {@n_val@}\).</p></p><p><b>(b) </b>Thus the sum is \( \dfrac{{@n_val@}({@u1@}+{@u_fin@})}{2} = {@ta2@} \).</p>]]></text>
    </generalfeedback>
    <defaultgrade>1</defaultgrade>
    <penalty>0.1</penalty>
    <hidden>0</hidden>
    <idnumber/>
    <stackversion>
      <text>2020081700</text>
    </stackversion>
    <questionvariables>
      <text>a1: rand(5)+3
d: rand([3,4,5,6])
n_val: rand(15)+75
un(n):=a1+(n-1)*d
u1: un(1)
u2: un(2)
u3: un(3)
u_fin: un(n_val)

ta1: n_val
ta2: n_val*(a1+u_fin)/2</text>
    </questionvariables>
    <specificfeedback format="html">
      <text/>
    </specificfeedback>
    <questionnote format="moodle_auto_format">
      <text>\({@u1@}+{@u2@}+{@u3@}+\cdots+{@u_fin@}\) so \( n = {@ta1@}\) sum={@ta2@}</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>numerical</type>
      <tans>ta1</tans>
      <boxsize>15</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords>+,-,*</forbidwords>
      <allowwords/>
      <forbidfloat>1</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>1</showvalidation>
      <options/>
    </input>
    <input>
      <name>ans2</name>
      <type>numerical</type>
      <tans>ta2</tans>
      <boxsize>15</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords>+,-,*,/</forbidwords>
      <allowwords/>
      <forbidfloat>1</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>1</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>ta1</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>
    </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>ta2</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>
    </prt>
    <deployedseed>1127942439</deployedseed>
    <deployedseed>1569772831</deployedseed>
    <deployedseed>777712550</deployedseed>
    <deployedseed>496816447</deployedseed>
    <deployedseed>1744636502</deployedseed>
    <deployedseed>1852537153</deployedseed>
    <deployedseed>938650678</deployedseed>
    <deployedseed>1889087787</deployedseed>
    <deployedseed>1504852418</deployedseed>
    <deployedseed>1490159019</deployedseed>
    <deployedseed>431521019</deployedseed>
    <deployedseed>155064995</deployedseed>
    <deployedseed>967824677</deployedseed>
    <deployedseed>1741604514</deployedseed>
    <deployedseed>756583418</deployedseed>
    <deployedseed>1189840585</deployedseed>
    <deployedseed>1707106826</deployedseed>
    <deployedseed>1579441629</deployedseed>
    <deployedseed>1702021109</deployedseed>
    <deployedseed>227031777</deployedseed>
    <deployedseed>1693661928</deployedseed>
    <deployedseed>289456085</deployedseed>
    <deployedseed>1050693560</deployedseed>
    <deployedseed>1432408677</deployedseed>
    <deployedseed>1808056789</deployedseed>
    <deployedseed>1638744859</deployedseed>
    <deployedseed>484827233</deployedseed>
    <deployedseed>1395595339</deployedseed>
    <deployedseed>643068777</deployedseed>
    <deployedseed>1689610371</deployedseed>
    <deployedseed>112101964</deployedseed>
    <deployedseed>1730887296</deployedseed>
    <deployedseed>381286119</deployedseed>
    <deployedseed>601092555</deployedseed>
    <deployedseed>1745788499</deployedseed>
    <deployedseed>1358862819</deployedseed>
    <deployedseed>791928904</deployedseed>
    <deployedseed>977570756</deployedseed>
    <deployedseed>916785971</deployedseed>
    <deployedseed>1167606844</deployedseed>
    <qtest>
      <testcase>1</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>ta1</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>ta2</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>
    </qtest>
    <qtest>
      <testcase>2</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>ev(ta1+1,simp)</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>ev(ta2+1,simp)</value>
      </testinput>
      <expected>
        <name>prt1</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>prt1-1-F</expectedanswernote>
      </expected>
      <expected>
        <name>prt2</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>prt2-1-F</expectedanswernote>
      </expected>
    </qtest>
  </question>
</quiz>
