Next topic: Applying and manipulating transformations

Representation of derivatives in Redberry is very similar to other systems and is very close to standard mathematical sense of this concept. However, presence of indices brings new features of derivatives with respect to indexed arguments.

Consider first the common mathematical notation for derivatives of ordinary
functions. The standard notation $f'(y)$ is really a shorthand for $\left.
\frac{d}{d x} f(x)\right|_{x = y}$ etc. Redberry uses the `~`

symbol followed by the derivative order (or orders in case of function with
several arguments) instead of primes. So, for example, the following expression

def t = 'f~(3)[x**2]'.trepresents \(\left. \frac{d^3}{d t^3} f\left(t\right) \right|_{t = x^2} \). When substituting e.g. \(f(t) = \sin t\) in the above expression one will have

println 'f[x] = Sin[x]'.t >> 'f~(3)[x**2]'.t

> -Cos[x**2]

In the case of multivariate functions, one should specify how many times to differentiate with respect to each slot (argument):

def t = 'f~(2, 3, 0)[a**2, w, q]'.trepresents \( \displaystyle \left. \frac{\partial^5}{\partial x^2 \partial y^3} f\left(x, y, q\right) \right|_{x = a^2 ,\, y =w}\). The above notation applies to derivatives of pure tensor fields; if one need to take derivative of some particular expression one should use Differentiate transformation or use

`D[vars][exp]`

syntax:
println 'D[x, y][y*x**2 + x*y**2 + f[x, y]]'.t

> 2*x + 2*y + f~(1,1)[x, y]

In the case of indexed objects one should append additional indices of differentiation variables. For example, expression

def t = 'F~(2)_{mn ab}^{cd}[f_ab]'.trepresents \( \left. \frac{\delta}{\delta t^{ab}} \frac{\delta}{\delta t_{cd}} F_{mn}\left(t_{ab}\right) \right|_{t_{ab} = f_{ab}} \). As we see, the inverted indices of differentiation variables should be appended to the indices of pure tensor field. Since the relative ordering of derivatives is irrelevant, the indices of derivative have additional symmetries. From the previous example:

println t.indices.symmetries.permutationGroup

> Group( +[[2, 4], [3, 5]] )

Indices of differentiation variables are appended sequentially starting from the first argument. So, for example, expression:

def t = 'F~(1, 1)_{mnabcde}[f_abc, f_ab]'.trepresents \( \displaystyle \frac{\delta}{\delta f^{abc}} \frac{\delta}{\delta f^{de}} F_{mn}\left(f_{abc}, f_{ab}\right) \) but not \( \displaystyle \frac{\delta}{\delta f^{cde}} \frac{\delta}{\delta f^{ab}} F_{mn}\left(f_{abc}, f_{ab}\right) \).

- Related reference material: Differentiate