<?xml version="1.0" encoding="UTF-8"?>
<quiz>
  <question type="stack">
    <name>
      <text>HELM 31.2 E5 Simpson's rule, intervals</text>
    </name>
    <questiontext format="markdown">
      <text><![CDATA[**31.2 E5 Composite Simpson's rule, precision**

Determine the minimum number of steps needed to guarantee an absolute error not exceeding
{@(stackfltfmt:"~f",err)@} when numerically evaluating

\\\( \displaystyle {@'integrate(f,x,a,b)@} \\\)

using Simpson’s rule.


\\\(N=\\\) [[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>2024012900</text>
    </stackversion>
    <questionvariables>
      <text><![CDATA[[f, a, b, ddddf]: [log(x), 2, 4, at(diff(log(x),x,4),x=2)];
[f, a, b, ddddf]: rand([
  [log(x), 1, 4, at(diff(log(x),x,4),x=2)],
  [log(x), 3, 4, at(diff(log(x),x,4),x=2)],
  [log(x), 3, 4, at(diff(log(x),x,4),x=2)],
  [log(x), 1, 3, at(diff(log(x),x,4),x=2)],
  [sin(x), 0, pi, at(diff(sin(x),x,4),x=pi/2)],
  [cos(2*x), 0, pi/2, at(diff(cos(2*x),x,4),x=0)]
]);
err: rand([0.001, 0.0001, 0.00001, 0.000001]);

h: ev(h,solve(err=ddddf*(b-a)*h^4/180,h));
ivr: ceiling(abs((b-a)/h));
if oddp(ivr) then iv:ivr+1 else iv:ivr;

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>{@[f,a,b,ddddf,err]@} {@ivr@} {@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</tans>
      <boxsize>5</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint>integer</syntaxhint>
      <syntaxattribute>1</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>1</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>correct value?</description>
        <answertest>AlgEquiv</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>{@fb_unit(S_iv,iv , 0.005)@}</text>
        </falsefeedback>
      </node>
      <node>
        <name>1</name>
        <description>is N even?</description>
        <answertest>AlgEquiv</answertest>
        <sans>evenp(S_iv)</sans>
        <tans>true</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>+</truescoremode>
        <truescore>0</truescore>
        <truepenalty/>
        <truenextnode>0</truenextnode>
        <trueanswernote>iv-2-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>-</falsescoremode>
        <falsescore>0</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>iv-2-F</falseanswernote>
        <falsefeedback format="html">
          <text>\(N\) must be even for Simpson's rule.</text>
        </falsefeedback>
      </node>
    </prt>
    <deployedseed>1666272798</deployedseed>
    <deployedseed>36725630</deployedseed>
    <deployedseed>1006023209</deployedseed>
    <deployedseed>1131128933</deployedseed>
    <deployedseed>186153235</deployedseed>
    <deployedseed>859648525</deployedseed>
    <deployedseed>949516628</deployedseed>
    <deployedseed>1961907446</deployedseed>
    <qtest>
      <testcase>1</testcase>
      <description>Test case assuming the teacher's input gets full marks.</description>
      <testinput>
        <name>S_iv</name>
        <value>iv</value>
      </testinput>
      <expected>
        <name>iv</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>iv-1-T</expectedanswernote>
      </expected>
    </qtest>
  </question>
</quiz>
