Function Repository Resource:

# ChainD

Get the derivative with respect to a function

Contributed by: Carl Woll
 ResourceFunction["ChainD"][f, g] gives the partial derivative of f with respect to g, where both f and g are functions of the same variable. ResourceFunction["ChainD"][f, {g, n}] gives the nth derivative. ResourceFunction["ChainD"][f, g1,g2,…] gives the partial derivative of f with respect to g1 followed by the partial derivative with respect to g2, etc.

## Details and Options

Only derivatives with respect to univariate functions are supported.
When differentiating with respect to multiple functions, each function must be a univariate function, but they need not be functions of the same variable.
Derivatives with respect to different functions are, in general, not commutative.
A symbolic inverse of the function g(x) is not required.
Derivatives with respect to functions are obtained using the relation .

## Examples

### Basic Examples (2)

Derivative of x4 with respect to x2:

 In[1]:=
 Out[1]=

Derivative of a more complicated function:

 In[2]:=
 Out[2]=

### Scope (2)

It is not necessary to be able to symbolically invert g(x):

 In[3]:=
 Out[3]=

It is not possible to symbolically invert BesselJ[2,x]:

 In[4]:=
 Out[4]=

Derivative of a multivariate function with respect to functions of each of the variables:

 In[5]:=
 Out[5]=

### Possible Issues (2)

When using ChainD with multiple functions, the result in general depends on the order of derivatives:

 In[6]:=
 Out[6]=
 In[7]:=
 Out[7]=

Derivatives with respect to heads of functions are not supported:

 In[8]:=
 Out[8]=

Carl Woll

## Version History

• 2.0.0 – 28 February 2020
• 1.0.0 – 23 October 2019