# A Wolfram Notebook on thn Derivatives

th

n

## Introduction

Introduction

Derivatives of functions play a fundamental role in calculus and its applications. The function D computes derivatives of various types in the Wolfram Language and is one of the most-used functions in the system.

Starting from the derivative of a function, one can compute derivatives of higher orders to gain further insight into the physical phenomenon described by the function. For example, suppose that the position of a particle moving along a straight line at time is defined as follows.

s(t)

t

In[1]:=

s[t_]:=t^5-10t+(1/12)Sin[3t]

Then, the velocity and the acceleration of the particle are given by its first and second derivatives, respectively. The higher derivatives too can be computed easily using D; they also have special names, which can be seen in the following computation.

In[2]:=

{velocity,acceleration,jerk,snap,crackle,pop}=Table[D[s[t],{t,i}],{i,6}];

In[3]:=

Plot[Evaluate[{x[t],velocity,acceleration,jerk,snap,crackle,pop}],{t,0,Pi},Exclusions->None,PlotLegends->{"position","velocity","acceleration","jerk","snap","crackle","pop"},PlotRange->All]

Out[3]=

Recent versions of the Wolfram Language allow you to compute not just the derivative of any specific order for a function, but also closed-form expressions for derivatives of symbolic order n using D. Such a closed form encodes all the information required to compute higher derivatives of the function.

Here we will give some examples for computing these derivatives, starting with an elementary example to illustrate how one might guess a formula for the derivative. Next, we create a table of derivatives to show that sophisticated special functions are needed to express the closed forms in general. Finally, we show that the calculus of derivatives is a generalization of the ordinary calculus of derivatives by exhibiting the sum, product and chain rules for these derivatives.

th

n

th

n

th

n

th

n

## An Elementary Example

An Elementary Example

Let us begin by considering the cosine function. Its first four derivatives are given by:

In[4]:=

Table[D[Cos[x],{x,n}],{n,4}]

Out[4]=

{-Sin[x],-Cos[x],Sin[x],Cos[x]}

There is a clear pattern in the table, namely that each derivative may be obtained by adding a multiple of to , as shown here.

π/2

x

In[5]:=

Table[Cos[x+(nπ)/2],{n,4}]

Out[5]=

{-Sin[x],-Cos[x],Sin[x],Cos[x]}

In[6]:=

D[Cos[x],{x,n}]

Out[6]=

Cos+x

nπ

2

An immediate application of the above closed form would be to compute higher-order derivatives of Cos with blinding speed. D itself uses this method to compute the billionth derivative of Cos in a flash, as shown here.

In[7]:=

D[Cos[x],{x,10^9}]//Timing

Out[7]=

{0.000572,Cos[x]}

Next, we note that, starting from the derivative, one can obtain derivatives of symbolic order specified by arbitrary expressions. For example, the derivative of Cos can be obtained by using a replacement rule, as shown here.

th

n

th

(n-1)

In[8]:=

D[Cos[x],{x,n}]/.{n(n-1)}

Out[8]=

Cos(-1+n)π+x

1

2

This technique can be used to reproduce the pattern of derivatives that led us to guess the closed form for the derivative of Cos, as follows.

th

n

In[9]:=

Refine[Table[D[Cos[x],{x,n}]/.{n4n+i},{i,1,4}],n∈Integers&&n>=0]

Out[9]=

{-Sin[x],-Cos[x],Sin[x],Cos[x]}

Finally, the closed-form expression for the derivative can be used to perform “integration through infinite differentiation” using the following formula.

th

n

x

∫

0

∞

∑

n=0

n+1

x

n

(-1)

∂

{x,n}

(n+1)!

The formula can be proved, for example, using repeated integration by parts. Applying it to Cos, we recover the integral of this function, as shown here.

In[10]:=

f[t_]:=Cos[t]

In[11]:=

Sum[(x^(n+1)(-1)^nD[f[x],{x,n}])/(n+1)!,{n,0,Infinity}]

Out[11]=

Sin[x]

In[12]:=

Integrate[Cos[t],{t,0,x}]

Out[12]=

Sin[x]

## Table of thn Derivatives

Table of Derivatives

th

n

The Wolfram Language has a rich variety of mathematical functions, starting from elementary functions, such as Power, to advanced special functions, such as EllipticE. The derivatives for many of these functions can be computed in closed form using D. The following table captures the beauty and complexity of these formulas.

th

n

In[13]:=

Clear[f];flist={E^x,x^n,Log[x],Sin[x],ArcTan[x],Sinh[x],ArcCosh[x],E^(-x^2/2),ChebyshevT[n,x],EllipticE[x]};

In[14]:=

TraditionalFormGridJoinf[x],f[x],Transposeflist,#1&/@flist,Background{None,{{None,GrayLevel[0.9]}},{{1,1}Hue[0.6,0.4,1],{1,2}Hue[0.6,0.4,1]}},BaseStyle{FontFamilyTimes,FontSize12},DividersAll,FrameStyleHue[0.6,0.4,0.8],Spacings{2,1}

∂

{x,n}

∂

{x,n}

Out[14]//TraditionalForm=

f(x) | n ∂ ∂ n x | ||||||

x | x | ||||||

n x |
| ||||||

log(x) |
| ||||||

sin(x) | sin πn 2 | ||||||

-1 tan | π n-1 2 1-n x 3 F 2 1 2 n 2 3-n 2 2 x | ||||||

sinh(x) | n (-) πn 2 | ||||||

-1 cosh |
| ||||||

- 2 x 2 | π n 2 -n x 2 F 2 1 2 1 2 n 2 2 x 2 | ||||||

T n |
| ||||||

E(x) | 1 2 -n x 2 F 1 1 2 1 2 |

Some of the entries in the table are rather simple. For example, the first entry states that all the derivatives of the exponential function are equal to the function itself, which generalizes the following result from basic calculus.

These answers agree with the ones obtained if D is used separately for each derivative computation. The results are then simplified.

This closed form can also be expressed in terms of Hermite polynomials, which can be verified in specific cases, as shown here.

The higher derivatives of a function generate oscillations. This remarkable phenomenon is illustrated here using a few derivatives of the Gaussian function considered by us.

## The Sum, Product and Chain Rules

The Sum, Product and Chain Rules

The product rule, or the so-called Leibniz rule, gives an answer that is essentially a binomial expansion, expressed as a sum wrapped in Inactive to prevent evaluation.

Finally, there is a form of the chain rule due to the pious Italian priest Francesco Faà di Bruno (1825–1888). This is given by a rather messy expression in terms of BellY, and states that: