Function Repository Resource:

ChainRule

Source Notebook

See how to apply the chain rule for derivatives

Contributed by: Wolfram|Alpha Math Team

ResourceFunction["ChainRule"][f,x]

applies the chain rule for computing the derivative of f with respect to x, returned as an inactive result.

Details

ResourceFunction["ChainRule"] accepts the following options:
"PrintRule"Falseprint a statement of the chain rule
"PrintNapkin"Falseprint the side "napkin" work needed for computing components of the chain rule
“InactiveInnerDerivatives"Falsekeep the derivatives of the components inactivated

Examples

Basic Examples (1) 

See how to apply the chain rule to compute the derivative of sin(x2) with respect to x:

In[1]:=
ResourceFunction["ChainRule"][Sin[x^2], x]
Out[1]=

Options (3) 

InactiveInnerDerivatives (1) 

Setting "InactiveInnerDerivatives" to True inactivates the derivatives of the factors of the chain rule, represented with a replacement rule:

In[2]:=
ResourceFunction["ChainRule"][Log[Tan[x]], x, "InactiveInnerDerivatives" -> True]
Out[2]=

PrintNapkin (1) 

Setting "PrintNapkin" to True prints a grid with the side "napkin" work needed to apply the chain rule (i.e., identifying and computing the derivatives of the inner and outer functions):

In[3]:=
ResourceFunction["ChainRule"][Exp[4 x^8], x, "PrintNapkin" -> True]
Out[3]=

PrintRule (1) 

Setting "PrintRule" to True prints a general statement of the chain rule for derivatives:

In[4]:=
ResourceFunction["ChainRule"][ Cos[5 x], x, "PrintRule" -> True]
Out[4]=

Publisher

Wolfram|Alpha Math Team

Version History

  • 2.0.1 – 03 April 2023
  • 2.0.0 – 23 March 2023
  • 1.0.0 – 10 January 2023

Related Resources

Author Notes

To view the full source code for ChainRule, evaluate the following:

License Information