<?xml version="1.0" encoding="UTF-8"?>
<quiz>
  <question type="stack">
    <name>
      <text>HELM 32.1 E4 Trapezium Method, Application</text>
    </name>
    <questiontext format="markdown">
      <text>**32.1 E4 Trapezium Method, Application**

The current \\\(i\\\) in a simple circuit involving a resistor of resistance \\\(R\\\), an inductance loop of
inductance \\\(L\\\) with applied voltage \\\(E\\\) satisﬁes the diﬀerential equation

\\\[\displaystyle L\frac{{\rm d} i}{{\rm d} t}+Ri=E\\\]

Consider the case where {@'L =L@}, {@'R = R@} and {@'E = E@}. Given that \\\(i(0) = 0\\\) use a value of
{@'h = h@} in implementation of the trapezium method to approximate the current \\\(i\\\) for  the first two time steps

\\\(i({@h@})\approx\\\) [[input:S_y1]] [[validation:S_y1]] [[feedback:y1]]

\\\(i({@2*h@})\approx\\\) [[input:S_y2]] [[validation:S_y2]] [[feedback:y2]]</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[dy(t,y):=(E-R*y)/L;
L: rand([1, 1.5, 2]);
R: rand([100,220, 470]);
E: rand([500,600, 800]);
h: 0.01*rand([0.1, 0.05, 0.02, 0.01, 0.2, 0.5]); 
y0: 0; 
y1: ev(y1, solve(y1=y0+h/2*(dy(0,y0)+dy(  h,y1)),y1));
y2: ev(y2, solve(y2=y1+h/2*(dy(h,y1)+dy(2*h,y2)),y2));


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>{@E@}, {@h@} {@R@} {@L@} {@dispsf(y1,4)@} {@dispsf(y2,4)@}</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_y1</name>
      <type>numerical</type>
      <tans>y1</tans>
      <boxsize>6</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>
    <input>
      <name>S_y2</name>
      <type>numerical</type>
      <tans>y2</tans>
      <boxsize>6</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>y1</name>
      <value>1.0000000</value>
      <autosimplify>1</autosimplify>
      <feedbackstyle>2</feedbackstyle>
      <feedbackvariables>
        <text/>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>NumRelative</answertest>
        <sans>S_y1</sans>
        <tans>y1</tans>
        <testoptions>0.0005</testoptions>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>y1-1-T</trueanswernote>
        <truefeedback format="markdown">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>y1-1-F</falseanswernote>
        <falsefeedback format="markdown">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <prt>
      <name>y2</name>
      <value>1.0000000</value>
      <autosimplify>1</autosimplify>
      <feedbackstyle>2</feedbackstyle>
      <feedbackvariables>
        <text/>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>NumRelative</answertest>
        <sans>S_y2</sans>
        <tans>y2</tans>
        <testoptions>0.0005</testoptions>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>y2-1-T</trueanswernote>
        <truefeedback format="markdown">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>y2-1-F</falseanswernote>
        <falsefeedback format="markdown">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <deployedseed>104379708</deployedseed>
    <deployedseed>535627791</deployedseed>
    <deployedseed>1317622686</deployedseed>
    <deployedseed>1763530627</deployedseed>
    <deployedseed>530439213</deployedseed>
    <deployedseed>1383345196</deployedseed>
    <deployedseed>1962198211</deployedseed>
    <deployedseed>1638998476</deployedseed>
    <qtest>
      <testcase>1</testcase>
      <description>Test case assuming the teacher's input gets full marks.</description>
      <testinput>
        <name>S_y1</name>
        <value>dispsf(float(y1),4)</value>
      </testinput>
      <testinput>
        <name>S_y2</name>
        <value>dispsf(float(y2),4)</value>
      </testinput>
      <expected>
        <name>y1</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>y1-1-T</expectedanswernote>
      </expected>
      <expected>
        <name>y2</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>y2-1-T</expectedanswernote>
      </expected>
    </qtest>
  </question>
</quiz>
