Showing a Solution only after input

Hey Everyone, I have spent a lot of time this morning trying to figure this out. I have been able to calculate this derivative, but I want to show the derivative only after the user enters the correct function. Right now, the derivative is showing without entering the function.

<answer>
  <mathInput name="n">
    <label>Inner Function:</label>
  </mathInput>
  <award><m name="inner">3x+1</m></award>
</answer>

  <p><m>f'(x) = </m>
  <derivative name="fPrime">$inner</derivative></p>

Any help is appreciated. TYIA

I have come up with a solution (finally). I would be curious as to whether or not there would be a “cleaner” way to write this code. I decided on a table so that I could have things a bit more structured with my solution.

<tabular>
  <row>
    <cell>
      <p><m>f(x)=</m>
        
          <mathInput name="userExpression">
    
        </mathInput>
</p>
    </cell>
    <cell><m>g(x)=</m>

      <mathInput name="userExpression1">

      </mathInput>
      
    </cell>
  
  </row>
  <row>
    <cell>
      <p>
        <m>f'(x)=</m><derivative>$userExpression</derivative>
      </p>
    </cell>
    <cell>
      <m>g"(x)=</m>
        <derivative>$userExpression1</derivative>
    
    </cell>
  </row>
</tabular>

My coffee hasn’t kicked in yet so I might not be following your question correctly. Are you wanting to not show the derivative until the student enters the function you are expecting? If so, you can use a hide condition to only show something when the answer is correct. I’ve shared a couple of options depending on how much you might want to show.

<answer name="derivativeInput">
  <mathInput name="innerFunctionInput">
    <label>Inner Function:</label>
  </mathInput>
  3x+1
</answer>

<hr></hr>

<p>Option 1: Show f'(x)= at all times</p>

<p>
  <m>f'(x) = </m>
  <derivative name="fPrime"  hide="$derivativeInput.creditAchieved=0">$innerFunctionInput</derivative>
</p>

<hr></hr>


<p>Option 2: Show nothing until the answer is correct.</p>

<p hide="$derivativeInput.creditAchieved=0">
  <m>f'(x) = </m>
  <derivative name="fPrime">$innerFunctionInput</derivative>
</p>

I really like the tabular organization. A lot of people have been using it lately.

Thank you for your help!