Functional derivative: function_diff

### 5.19.1 Functional derivative: function_diff

The function_diff command finds the derivatives of functions (as opposed to expressions, see Section 5.15.1).

- function_diff takes one argument: f, a function.
- function_diff(f) returns the derivative f′ of f.

#### Examples.

- Input:
  function_diff(sin)
  Output:

  x↦ cosx

- Input:
  function_diff(sin)(x)
  Output:

  cosx

- Input:

  f(x):=x^2+x*cos(x)
  function_diff(f)

  Output:

  x↦ cosx−x sinx+2 x

- Input:
  function_diff(f)(x)
  Output:

  cosx−x sinx+2 x

- To define the function g as f′:
  Input:
  g:=function_diff(f)
- The function_diff instruction has the same effect as using the expression derivative diff (see Section 5.19.4) in conjunction with unapply (see Section 5.15.2):
  Input:

  g:=unapply(diff(f(x),x),x)
  g(x)

  Output:

  cosx−x sinx+2 x

Warning!!!
In Maple mode (see Section 2.5.2), for compatibility, D may be used in place of function_diff. For this reason, it is impossible to assign a variable named D in Maple mode (hence you can not name a geometric object D).