<?xml version="1.0" encoding="UTF-8"?>
<quiz>
  <question type="stack">
    <name>
      <text>HELM 31.2 E1 Composite trapezium rule</text>
    </name>
    <questiontext format="markdown">
      <text>**31.2 E1 Composite trapezium rule**

Using 4 subintervals in the composite trapezium rule approximate (to 4 s.f.)

\\\( \displaystyle {@'integrate(fn,x,a,b)@} \approx \\\)
[[input:S_iv]] [[validation:S_iv]] 

[[feedback:iv]]</text>
    </questiontext>
    <generalfeedback format="markdown">
      <text/>
    </generalfeedback>
    <defaultgrade>1</defaultgrade>
    <penalty>0.1</penalty>
    <hidden>0</hidden>
    <idnumber/>
    <stackversion>
      <text>2025102100</text>
    </stackversion>
    <questionvariables>
      <text><![CDATA[simp:false;
[fn, a, b]: rand([[sqrt(x),2,6],[x*sqrt(x),1,3],[cos(x),0,pi/2],[sin(x),0,pi]]);
simp:true;
n: 4;
h: (b-a)/n;
iv: ev(rat(h*(ev(fn,x=a)/2+ev(fn,x=b)/2 + sum(ev(fn,x=a+h*i),i,1,n-1))),simp);
iv_num: dispsf(iv,4);

stack_include("https://raw.githubusercontent.com/mkraska/meclib/main/Maxima/fb_value_EN.mac");]]></text>
    </questionvariables>
    <specificfeedback format="markdown">
      <text/>
    </specificfeedback>
    <questionnote format="moodle_auto_format">
      <text>\[{@fn@}, {@'x_p=xp@}, {@iv@}\]</text>
    </questionnote>
    <questiondescription format="markdown">
      <text/>
    </questiondescription>
    <questionsimplify>1</questionsimplify>
    <assumepositive>0</assumepositive>
    <assumereal>0</assumereal>
    <prtcorrect format="markdown">
      <text>Richtige Antwort, gut gemacht!</text>
    </prtcorrect>
    <prtpartiallycorrect format="markdown">
      <text>Ihre Antwort ist teilweise korrekt.</text>
    </prtpartiallycorrect>
    <prtincorrect format="markdown">
      <text>Falsche Antwort.</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>S_iv</name>
      <type>numerical</type>
      <tans>iv_num</tans>
      <boxsize>5</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint>4 s.f.</syntaxhint>
      <syntaxattribute>1</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>0</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options/>
    </input>
    <prt>
      <name>iv</name>
      <value>1.0000000</value>
      <autosimplify>1</autosimplify>
      <feedbackstyle>2</feedbackstyle>
      <feedbackvariables>
        <text/>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>NumSigFigs</answertest>
        <sans>S_iv</sans>
        <tans>iv</tans>
        <testoptions>4</testoptions>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>iv-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>iv-1-F</falseanswernote>
        <falsefeedback format="html">
          <text><![CDATA[<p>{@fb_unit(S_iv,iv , 0.005)@}</p>]]></text>
        </falsefeedback>
      </node>
    </prt>
    <deployedseed>1966620753</deployedseed>
    <deployedseed>2050557610</deployedseed>
    <deployedseed>1275619690</deployedseed>
    <qtest>
      <testcase>1</testcase>
      <description>Test case assuming the teacher's input gets full marks.</description>
      <testinput>
        <name>S_iv</name>
        <value>iv_num</value>
      </testinput>
      <expected>
        <name>iv</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>iv-1-T</expectedanswernote>
      </expected>
    </qtest>
    <qtest>
      <testcase>2</testcase>
      <description>Double value</description>
      <testinput>
        <name>S_iv</name>
        <value>dispsf(ev(float(2*iv),simp),4)</value>
      </testinput>
      <expected>
        <name>iv</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty/>
        <expectedanswernote>iv-1-F</expectedanswernote>
      </expected>
    </qtest>
  </question>
</quiz>
