<?xml version="1.0" encoding="UTF-8"?>
<quiz>
  <question type="stack">
    <name>
      <text>17.2.3.15 Polar to Cartesian exercise</text>
    </name>
    <questiontext format="moodle_auto_format">
      <text><![CDATA[<p>Find the Cartesian form of the following curves given in polar form
<ol class="HELM_parts_inline">
<li>\(r=\dfrac{{@bb@}}{\sin\theta+{@aa@}\cos\theta}\)</li>
<li>\(r={@cc@}\cos\theta\)</li>
</ol>
Do you recognise these equations? </p>

<ol class="HELM_parts">
<li>First equation: [[input:ans1]] [[validation:ans1]][[feedback:prt1]]</li>
<li>Second Equation: [[input:ans2]] [[validation:ans2]][[feedback:prt2]]</li>
</ol>]]></text>
    </questiontext>
    <generalfeedback format="moodle_auto_format">
      <text><![CDATA[<p>(a) We aim to find \(r=\dfrac{{@bb@}}{\sin\theta+{@aa@}\cos\theta}\) in Cartesian coordinates. Remembering that \(x = r \cos\theta\) and \(y = r\sin\theta\), we find:
\[
\begin{aligned}
r &= \frac{{@bb@}}{\sin\theta+{@aa@}\cos\theta}\\
r(\sin\theta+{@aa@}\cos\theta) &= {@bb@}\\
y + {@aa@}x &= {@bb@}\\
y &= {@-aa@}x + {@bb@}.
\end{aligned}
\]
Notice that this is the equation for the below line:</p>
[[jsxgraph]]
var board = JXG.JSXGraph.initBoard(divid, {
            boundingbox: [-3, {#bb#}+3, 3, {#bb#}-3],
            keepaspectratio: true,
            showCopyright: false,
            axis: true,
            showNavigation: true,
        });
		
		JXG.Options.text.useMathHax = true;
		
		var polar = board.create('curve', 
    [function(theta){ return ({#bb#}/(Math.sin(theta) + {#aa#} * Math.cos(theta))) },
     [0, 0], 0, 2*Math.PI],
    {curveType: 'polar'});

[[/jsxgraph]]

<p>(b) We aim to find \(r={@cc@}\cos\theta\) in Cartesian coordinates. We now that \(r = \sqrt{x^2 + y^2}\) and so solve as follows:
\[
\begin{aligned}
r &= {@cc@}\cos\theta\\
\sqrt{x^2+y^2} &= \frac{{@cc@}x}{\sqrt{x^2 + y^2}}\\
x^2+y^2 &= {@cc@}x\\
x^2-{@cc@}x + {@(cc/2)^2@} -  {@(cc/2)^2@} + y^2 &= 0\\
(x-{@cc/2@})^2 + y^2 &= {@(cc/2)^2@}
\end{aligned}
\]
Notice that this is the equation of a circle with centre at \(({@cc/2@}, 0)\) and radius of {@cc/2@}:</p>
[[jsxgraph]]
var board = JXG.JSXGraph.initBoard(divid, {
            boundingbox: [-0.1, 5, 5, -5],
            keepaspectratio: true,
            showCopyright: false,
            axis: true,
            showNavigation: true,
        });
		
		JXG.Options.text.useMathHax = true;
		
		var polar = board.create('curve', 
    [function(theta){ return ({#cc#}*Math.cos(theta)) },
     [0, 0], 0, 2*Math.PI],
    {curveType: 'polar'});

[[/jsxgraph]]]]></text>
    </generalfeedback>
    <defaultgrade>1</defaultgrade>
    <penalty>0.1</penalty>
    <hidden>0</hidden>
    <idnumber/>
    <stackversion>
      <text>2025073100</text>
    </stackversion>
    <questionvariables>
      <text>aa:rand(4)+2;
bb:rand(5)+1;
cc:rand(4)+2;

ta1: y = bb - aa * x;
ta2: x^2 + y^2 = cc * x;</text>
    </questionvariables>
    <specificfeedback format="html">
      <text/>
    </specificfeedback>
    <questionnote format="html">
      <text>(a) {@ta1@} and (b) {@ta2@}</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>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>
    <input>
      <name>ans2</name>
      <type>algebraic</type>
      <tans>ta2</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>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>
    <prt>
      <name>prt2</name>
      <value>1.0000000</value>
      <autosimplify>1</autosimplify>
      <feedbackstyle>1</feedbackstyle>
      <feedbackvariables>
        <text/>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans2</sans>
        <tans>ta2</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt2-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt2-1-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <deployedseed>1316691365</deployedseed>
    <deployedseed>1060126101</deployedseed>
    <deployedseed>620525072</deployedseed>
    <deployedseed>273456212</deployedseed>
    <deployedseed>367544322</deployedseed>
    <deployedseed>651186341</deployedseed>
    <deployedseed>627476806</deployedseed>
    <deployedseed>1443851651</deployedseed>
    <deployedseed>1965890335</deployedseed>
    <deployedseed>884833677</deployedseed>
    <deployedseed>1043536046</deployedseed>
    <deployedseed>1313021891</deployedseed>
    <deployedseed>877940292</deployedseed>
    <deployedseed>2095211145</deployedseed>
    <deployedseed>162378847</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>
      <testinput>
        <name>ans2</name>
        <value>ta2</value>
      </testinput>
      <expected>
        <name>prt1</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt1-1-T</expectedanswernote>
      </expected>
      <expected>
        <name>prt2</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt2-1-T</expectedanswernote>
      </expected>
    </qtest>
  </question>
</quiz>
