<?xml version="1.0" encoding="UTF-8"?>
<quiz>
  <question type="stack">
    <name>
      <text>2.1.3.2 Composite function 1</text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p class="HELM_exercise">Exercise </p>
<p>Given \(f\left(x\right) = {@fx@}\) and \(g\left(x\right) = {@gx@}\) find the composite functions:</p>
<ol class="HELM_parts">
<li><p> \(g\left(f\left(x\right)\right)=\) [[input:ans1]]. [[validation:ans1]] [[feedback:Result]]</p></li>
<li><p>\(f\left(g\left(x\right)\right)=\) [[input:ans2]]. [[validation:ans2]] [[feedback:prt2]]</p></li>
</ol>
<p><br></p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text><![CDATA[<p>We are given the functions \(f\left(x\right) = {@fx@}\) and \(g\left(x\right) = {@gx@}.\) Both of them have domain the whole \( \mathbb{R}.\)</p>
<ol class="HELM_parts">
<li>Substituting \(f\left(x\right)={@fx@}\) for \(x\) in the expression \(g\left(x\right) = {@gx@}\)
  we obtain the composite function: \[g\left(f\left(x\right)\right)={@gfx@}={@expgfx@}.\]</li>
<li>Similarly, substituting \(g\left(x\right) = {@gx@}\) for \(x\) in the expression \(f\left(x\right)={@fx@}\) we obtain: \[f\left(g\left(x\right)\right)={@expfgx@}.\]</li></ol>]]></text>
    </generalfeedback>
    <defaultgrade>1</defaultgrade>
    <penalty>0.1</penalty>
    <hidden>0</hidden>
    <idnumber/>
    <stackversion>
      <text>2021072200</text>
    </stackversion>
    <questionvariables>
      <text>amag:rand(8)+2;
 asign:2*rand(2) -1;
 a:amag * asign;
 bmag:rand(8)+2;
 bsign:2*rand(2) -1;
 b:bmag * bsign;
 c:rand(11)-5;
 mb:-b;
 mc:-c;

fx:x + a;
gx:b*x + mc;

gfx:b*fx-c;
expgfx: expand(gfx);
ta1: expgfx

fgx: gx + a;
expfgx: expand(fgx);
ta2:expfgx;

wronggfx:ev(-b*(x+a)-c,simp);
wrongfgx:ev((-b*(x)-c)+a,simp);
gxplusfx:exp(fx+gx);
gxmulfx:exp(fx*gx);
 sc:sconcat(c);
 smb:sconcat(mb);
 smc:sconcat(mc);</text>
    </questionvariables>
    <specificfeedback format="html">
      <text/>
    </specificfeedback>
    <questionnote format="moodle_auto_format">
      <text>Given \(f\left(x\right) = {@fx@}\) and \(g\left(x\right) = {@gx@}\) then \(g\left(f\left(x\right)\right)={@expgfx@}\) and \(f\left(g\left(x\right)\right)={@expfgx@}\).</text>
    </questionnote>
    <questiondescription format="moodle_auto_format">
      <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>none</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>10</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>1</forbidfloat>
      <requirelowestterms>1</requirelowestterms>
      <checkanswertype>1</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options/>
    </input>
    <input>
      <name>ans2</name>
      <type>algebraic</type>
      <tans>ta2</tans>
      <boxsize>10</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>prt2</name>
      <value>1.0000000</value>
      <autosimplify>1</autosimplify>
      <feedbackstyle>1</feedbackstyle>
      <feedbackvariables>
        <text/>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>EqualComAss</answertest>
        <sans>ans2</sans>
        <tans>ta2</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt2-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt2-1-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <prt>
      <name>Result</name>
      <value>1.0000000</value>
      <autosimplify>1</autosimplify>
      <feedbackstyle>1</feedbackstyle>
      <feedbackvariables>
        <text/>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>EqualComAss</answertest>
        <sans>ans1</sans>
        <tans>ta1</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>FNC-CMP-TRUE</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>1</falsenextnode>
        <falseanswernote>FNC-CMP-FALSE </falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
      <node>
        <name>1</name>
        <description/>
        <answertest>EqualComAss</answertest>
        <sans>ans1</sans>
        <tans>-b*(x+a)-c</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>0.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>MINUS_B</trueanswernote>
        <truefeedback format="html">
          <text><![CDATA[Your answer is almost right but you have a sign wrong.
 
 <p>The correct answer is {@gx@} not \({@mb@}({@fx@}) + {@mc@}\).</p>]]></text>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>2</falsenextnode>
        <falseanswernote>FNC-CMP-1-FALSE </falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
      <node>
        <name>2</name>
        <description/>
        <answertest>EqualComAss</answertest>
        <sans>ans1</sans>
        <tans>b*(x+a)+c</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>0.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>PLUS_C</trueanswernote>
        <truefeedback format="html">
          <text><![CDATA[Your answer is almost right but you have a sign wrong.
 
 <p>The correct answer is {@gx@} not \({@b@}({@fx@}) + {@c@}\).</p>]]></text>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>3</falsenextnode>
        <falseanswernote>FNC-CMP-2-FALSE </falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
      <node>
        <name>3</name>
        <description/>
        <answertest>EqualComAss</answertest>
        <sans>ans1</sans>
        <tans>-b*(x+a)+c</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>0.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>MINUS_B_PLUS_C</trueanswernote>
        <truefeedback format="html">
          <text><![CDATA[Your answer is almost right but you have a couple of signs wrong.
 
 <p>The correct answer is {@gx@} not \({@mb@}({@fx@}) + {@c@}\).</p>]]></text>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>4</falsenextnode>
        <falseanswernote>FNC-CMP-3-FALSE </falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
      <node>
        <name>4</name>
        <description/>
        <answertest>EqualComAss</answertest>
        <sans>ans1</sans>
        <tans>fx*gx</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>0.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>PRODUCT</trueanswernote>
        <truefeedback format="html">
          <text><![CDATA[<p>Your answer is the product of \(f\left(x\right)\) and \(g\left(y\right)\).  This is not the same as the composite function \(g\left(f\left(x\right)\right)\).</p>]]></text>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>5</falsenextnode>
        <falseanswernote>FNC-CMP-4-FALSE </falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
      <node>
        <name>5</name>
        <description/>
        <answertest>EqualComAss</answertest>
        <sans>ans1</sans>
        <tans>fx+gx</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>0.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>SUM</trueanswernote>
        <truefeedback format="html">
          <text><![CDATA[<p>Your answer is the sum of \(f\left(x\right)\) and \(g\left(y\right)\). This is not the same as the composite function \(g\left(f\left(x\right)\right)\).</p>]]></text>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>FNC-CMP-5-FALSE </falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <deployedseed>671787238</deployedseed>
    <deployedseed>2055797314</deployedseed>
    <deployedseed>1130557343</deployedseed>
    <deployedseed>1925468233</deployedseed>
    <deployedseed>480607277</deployedseed>
    <deployedseed>1902927799</deployedseed>
    <deployedseed>1180318623</deployedseed>
    <deployedseed>1367977283</deployedseed>
    <deployedseed>1070909043</deployedseed>
    <deployedseed>784457578</deployedseed>
    <deployedseed>1362009569</deployedseed>
    <deployedseed>1497773302</deployedseed>
    <deployedseed>1941088377</deployedseed>
    <deployedseed>1488138514</deployedseed>
    <deployedseed>925135800</deployedseed>
    <qtest>
      <testcase>1</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>ta1</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>ta2</value>
      </testinput>
      <expected>
        <name>prt2</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt2-1-T</expectedanswernote>
      </expected>
      <expected>
        <name>Result</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>FNC-CMP-TRUE</expectedanswernote>
      </expected>
    </qtest>
    <qtest>
      <testcase>2</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>fx*gx</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>wrongfgx</value>
      </testinput>
      <expected>
        <name>prt2</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>prt2-1-F</expectedanswernote>
      </expected>
      <expected>
        <name>Result</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>PRODUCT</expectedanswernote>
      </expected>
    </qtest>
    <qtest>
      <testcase>3</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>b*(x+a)+c</value>
      </testinput>
      <expected>
        <name>Result</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>PLUS_C</expectedanswernote>
      </expected>
    </qtest>
    <qtest>
      <testcase>5</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>fx*gx</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>gx*fx</value>
      </testinput>
      <expected>
        <name>prt2</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>prt2-1-F</expectedanswernote>
      </expected>
      <expected>
        <name>Result</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>PRODUCT</expectedanswernote>
      </expected>
    </qtest>
    <qtest>
      <testcase>6</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>gx+fx</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>gx+fx</value>
      </testinput>
      <expected>
        <name>prt2</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>prt2-1-F</expectedanswernote>
      </expected>
      <expected>
        <name>Result</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>SUM</expectedanswernote>
      </expected>
    </qtest>
  </question>
</quiz>
