Derivative Tag inside <answer>

Hey Everyone,

I am trying to figure out how I can use the Derivative Tag so I don’t have to find and type each derivative by hand. I am trying with implicit differentiation. I have searched the help site because I thought I had posted this before, but I am having trouble with where the Derivative tag should go.

<setup>
  <function name="Ex1">x^2+4xy+y^2=4</function>
</setup>
  <subsection boxed>
  <title>
    Exercises
  </title>
      <introduction>
          Find <m>\dfrac{dy}{dx}</m> by using implicit differentiation for each of the following equations. 
           </introduction>
   
        <task> <p> <m>x^2-4xy+y^2=4\qquad</m> 
            <answer>
                <label>
                  <m>\dfrac{dy}{dx}=</m>
                </label>
                <derivative>$Ex1</derivative>
            </answer></p>
          </task>
</setup>     

Thank you for you help,

nick

Nick,

Try playing around with the <derivative> tag outside an answer to see how it works.

<p>f = <function name="f">x^2+3x+1</function></p>

<p>
  df/dx = 
<derivative>$f</derivative>
</p>

<p>g = <function name="g" variables="s t">3s^2t</function></p>

<p>dg/ds = <derivative>$g</derivative></p>
<p>dg/ds = <derivative derivVariables="s">$g</derivative></p>
<p>dg/dt = <derivative derivVariables="t">$g</derivative></p>
<p>d^2g/dsdt = <derivative derivVariables="s t">$g</derivative></p>

In your case, you have an = in the definition of f, so I’m not sure what that does for a derivative. Also, functions default to being a function of x alone, so you’ll need to add variables = "x y" if you want to take the derivative with respect to y as well.

The <derivative> tag works with mathematical expressions, not just functions.

Duane

Thank you, I did spend some time with the literature and found that I can define a function and use it within the block, but I was having difficulty with implicit. I tried on the scratchpad prior to posting, but was not having any luck.

I think I am struggling with the relationship between derivative and answer. I want to use the derivative feature so I don’t have to differentiate and write every answer within that block

Doenet doesn’t have any built-in support for implicit functions, which I see now is why you had the equal sign. The derivative doesn’t know about implicit functions. You’d have to try to fake it the best you can with taking the derivative of expressions.

<answer><derivative>x^2</derivative></answer> should behave the same as <answer>2x</answer>.

Yes, I was able to do that as well, but as soon as I try implicit, I get the error.