# Differences

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

 — documentation:ref:collectnonscalars [2015/11/21 12:33] (current) Line 1: Line 1: + ====== CollectNonScalars ====== + ---- + ====Description==== + * ''​CollectNonScalars''​ collects terms in sums with same tensorial parts. In contrast to standard Redberry behaviour when factored out tersorial parts with nonzero sized idices, ''​CollectNonScalars''​ tries to factor out parts with nonzero sized free indices. + ====Examples==== + ---- + Collect same tensorial parts: + + //by default, B_m will not be factored out + def t = '​A_i*A^i*B_m + B_m'.t + println t + ​ + ​ + > A_i*A^i*B_m + B_m + ​ + + //now will + println CollectNonScalars >> t + ​ + ​ + > (A_i*A^i + 1)*B_m + ​ + + ---- + Another example: + + setSymmetric '​R_mn'​ + println CollectNonScalars >> '​A_t*A^t*R_mn - B_t*B^t*R_nm'​.t + ​ + ​ + > (A_{t}*A^{t}-B_{t}*B^{t})*R_{mn} + ​ + ---- + + ====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/​CollectNonScalarsTransformation.html| CollectNonScalarFactorsTransformation]] + * Source code: [[https://​bitbucket.org/​redberry/​redberry/​src/​tip/​core/​src/​main/​java/​cc/​redberry/​core/​transformations/​CollectNonScalarsTransformation.java|CollectNonScalarsTransformation.java]]