Problem 8.4: Derive Exp (optional, 0 pts)
Implement derive-exp
, which uses the power rule to derive exponents. Reduce the power of the exponent by one, and multiply the entire expression by the original exponent.
Note: the formula for the derivative of an exponent is
[f(x)^(g(x))]' = g(x) * (f(x)^(g(x) - 1))
, if we ignore the chain rule, which we do for this problem
(define (derive-exp exp var)
'YOUR-CODE-HERE
)
Extensions
There are many ways to extend this symbolic differentiation system. For example, you could simplify nested exponentiation expression such as (^ (^ x 3) 2)
, products of exponents such as (* (^ x 2) (^ x 3))
, and sums of products such as (+ (* 2 x) (* 3 x))
. You could apply the chain rule when deriving exponents, so that expressions like (derive '(^ (^ x y) 3) 'x)
are handled correctly. Enjoy!