Differences

This shows you the differences between two versions of the page.

Link to this comparison view

documentation:ref:collectscalars [2015/11/21 12:33] (current)
Line 1: Line 1:
 +====== CollectScalars ======
 +----
 +
 +====Description====
 +  * ''​CollectScalars''​ collects similar scalar factors in products.
 +====Examples====
 +----
 +Collect same scalars in product:
 +<sxh groovy;​gutter:​false>​
 +println CollectScalars >> '​A_m*A^m*A_n*A^n'​.t
 +</​sxh>​
 +<sxh plain; gutter:​false>​
 +   > (A_{m}*A^{m})**2
 +</​sxh>​
 +
 +----
 +''​CollectScalars''​ may significantly simplify expression:
 +<sxh groovy;​gutter:​false>​
 +println CollectScalars >> '​t_mn*f^mn*t_ba*f^ba*R_ij + (t_mn*f^mn)**2*R_ij'​.t</​sxh>​
 +<sxh plain; gutter:​false>​
 +   > 2*(t_{mn}*f^{mn})**2*R_{ij}
 +</​sxh>​
 +
 +
 +----
 +''​CollectScalars''​ takes into account symmetries of tensors:
 +<sxh groovy;​gutter:​false>​
 +setSymmetric '​t_mn'​
 +println CollectScalars >> '​t_mn*f^mn*t_ab*f^ba*R_ij'​.t
 +</​sxh>​
 +<sxh plain; gutter:​false>​
 +   > (t_{mn}*f^{mn})**2*R_{ij}
 +</​sxh>​
 +
 +----
 +''​CollectScalars''​ collects scalars with any complicated structure:
 +<sxh groovy;​gutter:​false>​
 +println CollectScalars >> '(A_i + B_i)*(A^i + B^i)*(A_a + B_a)*(A^a + B^a)'​.t
 +</​sxh>​
 +<sxh plain; gutter:​false>​
 +   > ((A^{a}+B^{a})*(A_{a}+B_{a}))**2
 +</​sxh>​
 +
 +----
 +
 +====See also====
 +  * Related guides: [[documentation:​guide:​applying_and_manipulating_transformations]],​ [[documentation:​guide:​list_of_transformations]]
 +  * JavaDocs: [[http://​api.redberry.cc/​redberry/​1.1.9/​java-api/​cc/​redberry/​core/​transformations/​CollectScalarFactorsTransformation.html| CollectScalarFactorsTransformation]]
 +  * Source code: [[https://​bitbucket.org/​redberry/​redberry/​src/​tip/​core/​src/​main/​java/​cc/​redberry/​core/​transformations/​CollectScalarFactorsTransformation.java|CollectScalarFactorsTransformation.java]]