This shows you the differences between two versions of the page.
documentation:ref:tensorfield [2015/11/21 12:33] |
documentation:ref:tensorfield [2015/11/21 12:33] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== TensorField ====== | ||
+ | ---- | ||
+ | ====Basics==== | ||
+ | ''TensorField'' represents a function like ''f_mn[x_a]'' or derivative of function like ''f~(1)_a[x_i]''. Like any other expression, it inherits all properties of [[Tensor]]. Additionally it inherits all properties of [[SimpleTensor]] and adopts same convention on its indices: the indices of ''TensorField'' ([[SimpleIndices]]) are sorted by their [[documentation:ref:IndexType|types]], but the relative ordering of indices within a particular type is same as defined by the user: | ||
+ | <sxh groovy; gutter:false> | ||
+ | def t = 'f_cba^\\alpha_AB[t_mn, f_i]'.t | ||
+ | println t.indices | ||
+ | </sxh> | ||
+ | <sxh plain; gutter:false> | ||
+ | > _{cbaAB}^{\alpha} | ||
+ | </sxh> | ||
+ | The relative ordering is not changed even if tensor has symmetry property; in latter case Redberry uses algorithms provided by [[documentation:guide:Mappings of indices]] to compare expressions instead of trying to put expression in canonical form. | ||
+ | |||
+ | |||
+ | [[documentation:guide:symmetries_of_tensors|Symmetries]] of ''TensorField'' can be specified exactly in the same way as for [[SimpleTensor]]: | ||
+ | <sxh groovy; gutter: false> | ||
+ | addSymmetry 'f_pqr[k_l, k_l]', [1, 0].p | ||
+ | //or equivalently | ||
+ | 'f_klm[k_a, k_b]'.t.indices.symmetries.addSymmetry( [1, 0].p ) | ||
+ | </sxh> | ||
+ | |||
+ | <html><div><p style="padding-bottom:15px"> </p></div></html> | ||
+ | |||
+ | In case of derivatives, the total indices of ''TensorField'' are formed by concatenation of initial indices and inverted indices of differentiating variables. For example, the indices of | ||
+ | \[ | ||
+ | \frac{\delta}{\delta f^{abc}} \frac{\delta}{\delta f^{de}} F_{mn}\left(f_{abc}, f_{ab}\right) | ||
+ | \] | ||
+ | will be formed by sequential concatenation of initial indices $_{mn}$, indices of differentiating variable corresponding to first argument $_{abc}$ and indices of differentiating variable corresponding to second argument $_{de}$; thus, the resulting indices will be $_{mnabcde}$ and the corresponding tensor field | ||
+ | <sxh groovy; gutter: false> | ||
+ | 'F~(1, 1)_{mn abc de}[f_abc, f_ab]'.t | ||
+ | </sxh> | ||
+ | Additionally, if derivative taken several times with respect to same slot, the corresponding indices will be symmetric, since the relative order of differentiation is not relevant: | ||
+ | <sxh groovy; gutter: false> | ||
+ | println 'F~(2)_{mn ab cd}[f_ab] + F~(2)_{mn cd ab}[f_ab]'.t | ||
+ | </sxh> | ||
+ | <sxh plain; gutter: false> | ||
+ | > F~(2)_{mn ab cd}[f_ab] | ||
+ | </sxh> | ||
+ | |||
+ | <html><div><p style="padding-bottom:15px"> </p></div></html> | ||
+ | |||
+ | Since ''TensorField'' inherits both [[Tensor]] and [[SimpleTensor]] it provides all features found in them like container properties, utterable, symmetries etc. On the other hand, the ''.name'' property from [[SimpleTensor]] will additionally encode information about arguments of ''TensorFiels'', so e.g. functions like ''f_i[x_a]'' and ''f_i[x_ab]'' will have different ''.name''. | ||
+ | ====Additional features==== | ||
+ | The additional features of ''TensorField'' appear when it represents derivative: | ||
+ | |||
+ | <html> | ||
+ | <table style="width:600px;" cellpadding="10"> | ||
+ | <tr> | ||
+ | <td valign="top" style="padding: 15px;margin-top: 35px;border: 1px solid gray;"><code>.isDerivative()</code></td> | ||
+ | <td valign="top" style="padding: 15px;margin-top: 35px;border: 1px solid gray;">returns whether <code>TensorField</code> represents derivative of function (e.g. <code>f~(3)[x]</code>) or just function (e.g. <code>f[x]</code>)</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td valign="top" style="padding: 15px;margin-top: 35px;border: 1px solid gray;"><code>.getDerivativeOrder(i)</code></td> | ||
+ | <td valign="top" style="padding: 15px;margin-top: 35px;border: 1px solid gray;">returns order of derivative with respect to argument at <i>i</i>-th position</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td valign="top" style="padding: 15px;margin-top: 35px;border: 1px solid gray;"><code>.parentField</code></td> | ||
+ | <td valign="top" style="padding: 15px;margin-top: 35px;border: 1px solid gray;">returns function from which the derivative is taken </td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td valign="top" style="padding: 15px;margin-top: 35px;border: 1px solid gray;"><code>.partitionOfIndices</code></td> | ||
+ | <td valign="top" style="padding: 15px;margin-top: 35px;border: 1px solid gray;">returns partition of derivative indices; this partition separates indices of parent function and indices appended by derivatives </td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | </html> | ||
+ | |||
+ | Let us consider for example derivative | ||
+ | \(\displaystyle | ||
+ | \frac{\delta}{\delta x^{cd}} \frac{\delta^2}{\delta t^m \, \delta t^n} F_{ab}\left(x_{mn}, t_i, x\right) | ||
+ | \): | ||
+ | <sxh groovy; gutter: true> | ||
+ | def f = 'F~(1,2,0)_{ab cd mn}[x_mn, t_i, x]'.t | ||
+ | assert f.isDerivative() | ||
+ | println f.getDeivativeOrder(1) | ||
+ | </sxh> | ||
+ | <sxh plain; gutter: false> | ||
+ | > 2 | ||
+ | </sxh> | ||
+ | <sxh groovy; gutter: true; first-line: 4> | ||
+ | println f.parentField | ||
+ | </sxh> | ||
+ | <sxh plain; gutter: false> | ||
+ | > F_{ab}[x_{mn},t_{i},x] | ||
+ | </sxh> | ||
+ | <sxh groovy; gutter: true; first-line: 5> | ||
+ | println( (0..(f.size() - 1)).collect { f.getDeivativeOrder(it) }) | ||
+ | </sxh> | ||
+ | <sxh plain; gutter: false> | ||
+ | > [1, 2, 0] | ||
+ | </sxh> | ||
+ | <sxh groovy; gutter: true; first-line: 6> | ||
+ | println f.partitionOfIndices | ||
+ | </sxh> | ||
+ | <sxh plain; gutter: false> | ||
+ | > [[_{ab}], [_{cd}], [_{m}, _{n}], []] | ||
+ | </sxh> | ||
+ | The first element in ''.partitionOfIndices'' is indices of parent field, while //(i+1)//-th element of this array corresponds to indices of derivatives with respect to //i//-th slot. | ||
+ | |||
+ | ====See also==== | ||
+ | * Related guides: [[documentation:guide:tensors_and_indices]], [[documentation:guide:representation_of_derivatives]], [[documentation:guide:symmetries_of_tensors]] | ||
+ | * Reference: [[documentation:ref:tensor]], [[documentation:ref:simpletensor]], [[documentation:ref:simpleindices]], [[documentation:ref:differentiate]] | ||
+ | * JavaDocs: [[http://api.redberry.cc/redberry/1.1.9/java-api/cc/redberry/core/tensor/TensorField.html| TensorField]] | ||
+ | * Source code: [[https://bitbucket.org/redberry/redberry/src/tip/core/src/main/java/cc/redberry/core/tensor/TensorField.java|TensorField.java]] | ||