# [Maxima] More Chain Rule questions

Stavros Macrakis macrakis at alum.mit.edu
Wed May 28 15:08:51 CDT 2008

```I'm not sure I understand why you want the form you want.  Is it for teaching?

If so, you will want more control over Maxima's operations than you
get by using the default representation and algorithms.  In
particular, internally, Maxima does not represent divisions as
"/"(a,b) but as "*"(a,"^"(b,-1)), and (a/b)^7 is represented as
a^7/b^7 and so really as "*"("^"(a,7),"^"(b,-7)).

For more control, you could do something like the following:

gradef(div(a,b),1/b,-a/b^2)\$          <<< define derivatives for
your own division operator

Now,

diff( div(a*x+b,c*x+d)^7 , x) =>
7 * (a/(c*x+d)-c*(a*x+b)/(c*x+d)^2) * div(a*x+b,c*x+d)^6

(notice the treatment of the two-argument function div in the chain rule)

and subst("/",div,%) =>
7 * (a*x+b)^6 * (a/(c*x+d)-c*(a*x+b)/(c*x+d)^2) / (c*x+d)^6

There are several more simplification steps between this and the form
you want, but this is what you get when you really do follow the chain
rule step by step.

-s

*That* is the correct result using the chain rule.
```