This shows you the differences between two versions of the page.
documentation:guide:representation_of_derivatives [2015/11/21 12:33] |
documentation:guide:representation_of_derivatives [2015/11/21 12:33] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Representation of derivatives ====== | ||
+ | <html> | ||
+ | <div class="text-right" style="font-size: 15px; "> | ||
+ | </html> | ||
+ | Next topic: [[documentation:guide:applying_and_manipulating_transformations]] | ||
+ | <html> | ||
+ | <span class="glyphicon glyphicon-arrow-right"></span> | ||
+ | </div> | ||
+ | </html> | ||
+ | |||
+ | ---- | ||
+ | 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. | ||
+ | |||
+ | ====Indexless expressions==== | ||
+ | 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 | ||
+ | <sxh groovy; gutter: false> | ||
+ | def t = 'f~(3)[x**2]'.t | ||
+ | </sxh> | ||
+ | represents \(\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 | ||
+ | <sxh groovy; gutter: false> | ||
+ | println 'f[x] = Sin[x]'.t >> 'f~(3)[x**2]'.t | ||
+ | </sxh> | ||
+ | <sxh plain; gutter: false> | ||
+ | > -Cos[x**2] | ||
+ | </sxh> | ||
+ | |||
+ | In the case of multivariate functions, one should specify how many times to | ||
+ | differentiate with respect to each slot (argument): | ||
+ | <sxh groovy; gutter: false> | ||
+ | def t = 'f~(2, 3, 0)[a**2, w, q]'.t | ||
+ | </sxh> | ||
+ | represents \( \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 [[documentation:ref:differentiate|Differentiate]] transformation or use ''D[vars][exp]'' syntax: | ||
+ | <sxh groovy; gutter: false> | ||
+ | println 'D[x, y][y*x**2 + x*y**2 + f[x, y]]'.t | ||
+ | </sxh> | ||
+ | <sxh plain; gutter: false> | ||
+ | > 2*x + 2*y + f~(1,1)[x, y] | ||
+ | </sxh> | ||
+ | |||
+ | |||
+ | ====Indexed expressions==== | ||
+ | In the case of indexed objects one should append additional indices of differentiation variables. For example, expression | ||
+ | <sxh groovy; gutter: false> | ||
+ | def t = 'F~(2)_{mn ab}^{cd}[f_ab]'.t | ||
+ | </sxh> | ||
+ | represents \( \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: | ||
+ | <sxh groovy; gutter: false> | ||
+ | println t.indices.symmetries.permutationGroup | ||
+ | </sxh> | ||
+ | <sxh plain; gutter: false> | ||
+ | > Group( +[[2, 4], [3, 5]] ) | ||
+ | </sxh> | ||
+ | |||
+ | |||
+ | Indices of differentiation variables are appended sequentially starting from the first argument. So, for example, expression: | ||
+ | <sxh groovy; gutter: false> | ||
+ | def t = 'F~(1, 1)_{mnabcde}[f_abc, f_ab]'.t | ||
+ | </sxh> | ||
+ | represents \( \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) \). | ||
+ | ====See also==== | ||
+ | * Related reference material: [[documentation:ref:differentiate]] | ||