@symfun
: diff (f) ¶@symfun
: diff (f, x) ¶@symfun
: diff (f, x, x, …) ¶@symfun
: diff (f, x, n) ¶@symfun
: diff (f, x, y) ¶@symfun
: diff (f, x, x, y, y, …) ¶@symfun
: diff (f, x, n, y, m, …) ¶Symbolic differentiation of symbolic functions.
Mostly the same as @sym/diff
(and indeed it
calls that code) but returns a symfun
.
The derivative is itself a symfun so you can evaluate at a point like:
syms u(x) up = diff(u) % u'(x) ⇒ up(x) = (symfun) d ──(u(x)) dx up(2) % u'(2) ⇒ ans = (sym) ⎛d ⎞│ ⎜──(u(x))⎟│ ⎝dx ⎠│x=2
On GNU Octave, a further shortcut is possible:
syms u(x) diff(u)(2) ⇒ ans = (sym) ⎛d ⎞│ ⎜──(u(x))⎟│ ⎝dx ⎠│x=2
syms f(x, y) diff(f, x, y, y)(3, 2) % a third partial eval at (3, 2) ⇒ ans = (sym) ⎛ 3 ⎞│ ⎜ ∂ ⎟│ ⎜──────(f(x, y))⎟│ ⎜ 2 ⎟│ ⎝∂y ∂x ⎠│x=3, y=2
See also: @sym/diff, @symfun/int.
Package: symbolic