Differentiation

In secondary school, you learned the rules for differentiation an expression in $x$ with respect to a variable $x$.

We would now like you to describe an algorithm for calculating the derivative of an expression in $x$.

Algorithm X.1: Differentiating a constant

Describe an algorithm that calculates the derivative of a constant.

Input: a variable $x$ with respect to which the derivative should be calculated and a constant expression.
Output: an expression in $x$.

Algorithm X.2: Differentiating $x$ raised to a real power

Describe an algorithm that calculates the derivative of $x^r$ where $r$ is an arbitrary real number.

Input: a variable $x$ with respect to which the derivative should be calculated and a expression in the form $x^r$ where $r$ is a real number.
Output: an expression in $x$.

Algorithm X.4: Differentiating a sum

Describe an algorithm that calculates the derivative of a sum $f(x) + g(x)$.

Input: a variable $x$ with respect to which the derivative should be calculated and a expression in the form $x^r$ where $r$ is a real number.
Output: an expression in $x$.

Algorithm X.5: Differentiating a product

Describe an algorithm that calculates the derivative of a sum $f(x) g(x)$.

Algorithm X.6: Differentiating a product

Describe an algorithm that calculates the derivative of a ratio $\frac{f(x)}{g(x)}$.

Algorithm X.7: Differentiating a composition

Describe an algorithm that calculates the derivative of a composition $f(g(x))$.

For this algorithm, you can tell the computer to replace an expression like $g(x)$ with a variable $\xi$, to then apply the algorithm differentiating the expression with respect to $\xi$, and to then substitute back the expression $g(x)$ for $\xi$.

Algorithm X.8: Differentiating a function of $x$

Describe an algorithm for calculating the derivative of each of the following:

  • $\sin(x)$
  • $\cos(x)$
  • $\tan(x)$
  • $\sec(x)$
  • $\csc(x)$
  • $\cot(x)$
  • $\exp(x)$
  • $\ln(x)$
  • $\log_b(x)$

Algorithm X.9: Differentiating a exponential

Describe an algorithm that calculates the derivative of a $b^x$ for some base $b$. Are there any restrictions on $b$?

Algorithm X.10: Differentiating a expression

Now, finally, you must describe an algorithm that will differentiate an arbitrary expression. In your description, you may ask questions such as "If it is a sum, let $f(x)$ and $g(x)$ be the two operands of the sum, ...".

Questions

Is it necessary to describe an algorithm for calculating the derivative of $\frac{f(x)}{g(x)}$, or is it sufficient to treat this as $f(x)(g(x))^{-1}$ and apply the algorithm for a product followed by the algorithm for a power?

2. Is it necessary to describe the algorithm for calculating the derivative of $x^n$, or is it sufficient to treat this as $x \cdot x^{n - 1}$ and apply the algorithm for a product?

3. Does your algorithm find the derivative of

$\left(\frac{3}{x} + \sin\left(3.2 x^2 - 4.7\tan(x^4 + 3)\right)\right)^2 + \log_{10}(7.9 \csc(x) 2^x + 3.2 x^2)$.

Your answer should be

$2 \left( \frac{3}{x} + \sin \left( 3.2{x}^{2}- 4.7\tan \left( {x}^{4}+3 \right) \right) \right)$
$\left( -\frac{3}{x^2} + \left( 6.4x- 18.8{x}^{3} \left( 1+ \left( \tan \left( {x}^{4}+3 \right) \right) ^{2} \right) \right) \cos \left( 3.2{x}^{2}- 4.7\tan \left( {x}^{4}+3 \right) \right) \right)$
$+\frac {- 7.9\csc \left( x \right) \cot \left( x \right) {2}^{x}+ 7.9\csc \left( x \right) {2}^{x}\ln \left( 2 \right) + 6.4x}{ \left( 7.9\csc \left( x \right) {2}^{x}+ 3.2{x}^{ 2} \right) \ln \left( 10 \right) }$.