<?xml version="1.0" encoding="UTF-8"?>
<quiz>
  <question type="stack">
    <name>
      <text>29.2.3.11 Vector field div dot prod surface Integral</text>
    </name>
    <questiontext format="moodle_auto_format">
      <text><![CDATA[<p>Evaluate the integral \(\displaystyle \iint_S \underline{\nabla}\phi \cdot \underline{\mathrm{d}S}\) for \(\phi = {@x^aa * z^bb@} \sin y\) and \(S\) being the rectangle bounded by \((0, 0, 0)\), \((1, 0, 1)\), \((1, \pi, 1)\) and \((0, \pi, 0)\). </p>

<p>\(\displaystyle \iint_S \underline{\nabla}\phi \cdot \underline{\mathrm{d}S} =\) [[input:ans1]][[validation:ans1]]</p>]]></text>
    </questiontext>
    <generalfeedback format="moodle_auto_format">
      <text><![CDATA[<p>We aim to evaluate the integral \(\displaystyle \iint_S \underline{\nabla}\phi \cdot \underline{\mathrm{d}S}\) for \(\phi = {@x^aa*z^bb@} \sin y\) and \(S\) being the rectangle bounded by \((0, 0, 0)\), \((1, 0, 1)\), \((1, \pi, 1)\) and \((0, \pi, 0)\). </p>

<p>We first aim to find the vector \(\underline{\mathrm{d}S}\). Firstly, we can chose two perpendicular vectors inside the rectangle, and take their cross product to find the normal vector, let \(\underline{u} = \underline{j}\), \(\underline{v} = \underline{i} + \underline{k}\), then:
\[
\begin{aligned}
\underline{u} \times \underline{v} &= \begin{vmatrix}
\underline{i} & \underline{j} & \underline{k}\\
0 & 1 & 0 \\
1 & 0 & 1
\end{vmatrix}\\
&= ((1)(1)- (0)(0))\underline{i} - ((0)(1) - (0)(1))\underline{j} + ((0)(0) - (1)(1))\underline{k}\\
&= \underline{i} - \underline{k}\\
&\text{now calculating }\underline{\hat{n}}\\
\underline{\hat{n}}&= \frac{\underline{i} - \underline{k}}{\sqrt{1^2+1^2}}\\
&= \frac{\underline{i}}{\sqrt{2}} - \frac{\underline{k}}{\sqrt{2}}.
\end{aligned}
\]
Now the area of this rectangle is \(A_1 = \sqrt{2}\pi\), the area of its projection onto the \(y-z\) plane is: \(A_2 = \pi\). Therefore we find \(\underline{\mathrm{d}S} = \dfrac{A_1}{A_2}\underline{\hat{n}} \mathrm{d}y\mathrm{d}z = (\underline{i} - \underline{k})\mathrm{d}y\mathrm{d}z.\)</p>

<p>Now we can find the bounds of the double integral. The outer integral has upper bound \(z= 1\) and lower bound \(z=0\). The inner integral has upper bound \(y= \pi\) and lower bound \(y=0\). Therefore we can calculate the the surface integral as follows (bearing in mind that \(x=z\) due to the original rectangle lying in the said plane)):
\[
\begin{aligned}
\iint_S \underline{\nabla}\phi \cdot \underline{\mathrm{d}S} &= \iint_S \left[ ({@diffi@})\underline{i} + ({@diffj@})\underline{j} + ({@diffk@})\underline{k}\right]\cdot \underline{\mathrm{d}S}\\
&=\int^{z= 1}_{z= 0} \int^{y= \pi}_{y=0} \left[ ({@diffi@})\underline{i} + ({@diffj@})\underline{j} + ({@diffk@})\underline{k}\right] \cdot \left[\underline{i} - \underline{k}\right]\ \mathrm{d}y\ \mathrm{d}z\\
&= \int^{z= 1}_{z= 0} \int^{y= \pi}_{y=0} {@expres2@}\ \mathrm{d}y\ \mathrm{d}z\\
&= \int^{z= 1}_{z= 0} \left[{@First_int_indef@}\right]^{y= \pi}_{y=0}\ \mathrm{d}z\\
&=\int^{z= 1}_{z= 0} {@First_int_def@}\ \mathrm{d}z\\
&=\left[{@Second_int_indef@}\right]^{z= 1}_{z= 0}\\
&= {@Second_int_def@}
\end{aligned}
\]</p>]]></text>
    </generalfeedback>
    <defaultgrade>1</defaultgrade>
    <penalty>0.1</penalty>
    <hidden>0</hidden>
    <idnumber/>
    <stackversion>
      <text>2025073100</text>
    </stackversion>
    <questionvariables>
      <text>aa:rand(3)+1;
bb:rand(3)+1;


expression:x^aa*z^bb*sin(y);
diffi:diff(expression, x);
diffj:diff(expression, y);
diffk:diff(expression, z);
expres2:subst(z, x, diffi-diffk);
First_int_indef:integrate(expres2, y);
First_int_def:integrate(expres2, y, 0, pi);
Second_int_indef:integrate(First_int_def, z);
Second_int_def:integrate(First_int_def, z, 0, 1);

ta:Second_int_def;</text>
    </questionvariables>
    <specificfeedback format="html">
      <text>[[feedback:prt1]]</text>
    </specificfeedback>
    <questionnote format="html">
      <text>\(\phi = {@x^aa * z^bb@} \sin y\) so \(\displaystyle \iint_S \underline{\nabla}\phi \cdot \underline{\mathrm{d}S} = {@ta@}\)</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>onum</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>ta</tans>
      <boxsize>15</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>ta</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>
      <node>
        <name>1</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans1</sans>
        <tans>-ta</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt1-2-T</trueanswernote>
        <truefeedback format="html">
          <text>Note: the normal vector going in the opposite direction than the one in the worked solution was chosen</text>
        </truefeedback>
        <falsescoremode>-</falsescoremode>
        <falsescore>0</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt1-2-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <deployedseed>1993005554</deployedseed>
    <deployedseed>18725405</deployedseed>
    <deployedseed>323313737</deployedseed>
    <deployedseed>1319767501</deployedseed>
    <deployedseed>1212995911</deployedseed>
    <deployedseed>1710820217</deployedseed>
    <deployedseed>661337179</deployedseed>
    <deployedseed>1838418342</deployedseed>
    <qtest>
      <testcase>1</testcase>
      <description>Test case assuming the teacher's input gets full marks.</description>
      <testinput>
        <name>ans1</name>
        <value>ta</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>fail</description>
      <testinput>
        <name>ans1</name>
        <value>ta+1</value>
      </testinput>
      <expected>
        <name>prt1</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty/>
        <expectedanswernote>prt1-2-F</expectedanswernote>
      </expected>
    </qtest>
  </question>
</quiz>
