<?xml version="1.0" encoding="UTF-8"?>
<quiz>
  <question type="stack">
    <name>
      <text>27.1.5.3 Special Cases of Double Integrals Exercise</text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p class="HELM_exercise">Exercise</p>
<p>Evaluate the following integral</p>
<p>(Note: If you are struggling to see the upper integration limit of the outer integral on your device, it is: \(\displaystyle {@aa@}\)) </p>

<p>\(\displaystyle I=\displaystyle\int_{0}^{@aa@} \displaystyle \int_{0}^{@bb@} y\cos(x)\, \mathrm{d}y \mathrm{d}x \) </p>
<p> \(I=\) [[input:ans1]] [[validation:ans1]]</p><p>If your answer is not an integer, leave it in rational form e.g.&nbsp;<code>23/5</code>.<br></p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text><![CDATA[<p> The integration takes place over the rectangle shown below. </p>
[[jsxgraph]]
        var board = JXG.JSXGraph.initBoard(divid, {
            boundingbox: [-1, {#ymax#}, {#xmax#}, -1],
            keepaspectratio: true,
            axis: true,
            showCopyright: false,
			showNavigation: false,
			grid: false
		});
		
		// Hide tick labels and ticks on x-axis but label it
		board.defaultAxes.x.setAttribute({
		  ticks: {
			drawLabels: false, // hide numbers
			majorHeight: 0,
			minorHeight: 0
		  },
		  name: 'x',
		  withLabel: true,
		  label: {
			position: 'rt',
			offset: [1, -10]
		  }
		});

		// Hide tick labels and ticks on y-axis but label it
		board.defaultAxes.y.setAttribute({
		  ticks: {
			drawLabels: false,
			majorHeight: 0,
			minorHeight: 0
		  },
		  name: 'y',
		  withLabel: true,
		  label: {
			position: 'rt',
			offset: [-15, 0]
		  }
		});
		
		
		// points
		var bl = board.create('point', [0,0], {fixed: true, withLabel:false, visible: true, showInfobox: false, size: 3, face: 'o', fillColor: 'black', strokeColor: 'black'});
		var br = board.create('point', [{#float_aa#},0], {fixed: true, withLabel:false, visible: true, showInfobox: false, size: 3, face: 'o', fillColor: 'black', strokeColor: 'black'})
		var tr = board.create('point', [{#float_aa#},{#bb#}], {fixed: true, withLabel:false, visible: true, showInfobox: false, size: 3, face: 'o', fillColor: 'black', strokeColor: 'black'});
		var tl = board.create('point', [0,{#bb#}], {fixed: true, withLabel:false, visible: true, showInfobox: false, size: 3, face: 'o', fillColor: 'black', strokeColor: 'black'});
		var rectangle = board.create('polygon', [bl, br, tr, tl],{name:"Rectangle",withLabel:false, color: 'white'});
		
		// Set all edges (borders) to dark blue
		rectangle.borders.forEach(line => {
			line.setAttribute({strokeColor: 'darkblue'});
		});
		
		// Labels for points on left (x=0), show numeric coords
[bl, tl].forEach(pt => {
    board.create('text', [
        () => pt.X() + 0.15,
        () => pt.Y() + 0.15,
        () => `(${Math.round(pt.X())}, ${Math.round(pt.Y())})`
    ], {fontSize: 12, fixed: true, highlight: false});
});

// Labels for points on right (x = aa), show symbolic pi fraction for x
[br, tr].forEach(pt => {
    board.create('text', [
        () => {#float_aa#} + 0.15,
        () => pt.Y() + 0.15,
        () => `(${#ee*π#}$, ${Math.round(pt.Y())})`.replace(/\$/g, '')
    ], {fontSize: 12, fixed: true, highlight: false});
});
		
[[/jsxgraph]]<p> We have </p>
<p> \(\displaystyle I=\displaystyle\int_{0}^{@aa@} \displaystyle \int_{0}^{@bb@} y\cos(x)\, \mathrm{d}y \mathrm{d}x \) </p>
<p> Which we can rewrite as </p>
<p>  \(\displaystyle I=\displaystyle\int_{0}^{@aa@} \cos(x)\, \mathrm{d}x \times \displaystyle \int_{0}^{@bb@} y\, \mathrm{d}y \) </p>
<p> Evaluating, we get </p>
<p>\(\begin{align} I &= \left[\sin(x)\right]_{0}^{@aa@} \times \left[\dfrac{y^2}{2}\right]_{0}^{@bb@} \\ 
&=  \left(\sin\left({@aa@}\right) - 0\right) \times \left(\dfrac{{@bb@}^2}{2} - 0\right) \\ 
&=  {@sin(aa)*(bb)^2/2@} \end{align}\)</p>]]></text>
    </generalfeedback>
    <defaultgrade>1</defaultgrade>
    <penalty>0.1</penalty>
    <hidden>0</hidden>
    <idnumber/>
    <stackversion>
      <text>2025073100</text>
    </stackversion>
    <questionvariables>
      <text>cc: rand(5) + 1;
dd: rand(5) + 1;
aa: cc*(%pi)/dd;
ee: cc/dd;
float_aa: float(aa)
bb: rand(3) + 1;
xmax: float(aa + 2);
ymax: bb + 1;
exp: y*cos(x);
inn: int(exp, y, 0, bb);
ta1: int(inn, x, 0, aa);</text>
    </questionvariables>
    <specificfeedback format="html">
      <text>[[feedback:prt1]]</text>
    </specificfeedback>
    <questionnote format="html">
      <text><![CDATA[<p>\[I=\int_{0}^{@aa@}\int_{0}^{@bb@} y\cos(x) \,\mathrm{d}y \mathrm{d}x= {@ev(ta1, simp)@}\]</p>]]></text>
    </questionnote>
    <questiondescription format="html">
      <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>dot</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>8</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>
    <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</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>
    <deployedseed>1617076302</deployedseed>
    <deployedseed>275072255</deployedseed>
    <deployedseed>1416929461</deployedseed>
    <deployedseed>433694227</deployedseed>
    <deployedseed>2143563948</deployedseed>
    <deployedseed>766719770</deployedseed>
    <deployedseed>2027978146</deployedseed>
    <deployedseed>310534520</deployedseed>
    <deployedseed>1329580333</deployedseed>
    <deployedseed>489768314</deployedseed>
    <qtest>
      <testcase>1</testcase>
      <description>Test case assuming the teacher's input gets full marks.</description>
      <testinput>
        <name>ans1</name>
        <value>ta1</value>
      </testinput>
      <expected>
        <name>prt1</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt1-1-T</expectedanswernote>
      </expected>
    </qtest>
    <qtest>
      <testcase>2</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>ev(ta1 + 1, simp)</value>
      </testinput>
      <expected>
        <name>prt1</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty/>
        <expectedanswernote>prt1-1-F</expectedanswernote>
      </expected>
    </qtest>
    <tags>
      <tag><text>jsxgraph_solution</text>
</tag>
    </tags>
  </question>
</quiz>
