====== List of common transformations ======
Next topic: [[documentation:guide:overview_of_hep_features]]
---- Here is a list of basic transformations available in Redberry:
====Apply index mapping==== applies mapping of indices to tensors: println '{m -> b, n -> a}'.mapping >> 't_mn'.t > t_ba See [[documentation:guide:Mappings of indices]].
====Collect==== collects terms by patterns: def t = 'A_m*B_n + A_n*C_m'.t println Collect['A_m'.t] >> t > A_i*(d^i_m*B_n + d^i_n*C_m) See [[documentation:ref:Collect]] .
====CollectScalars==== collects similar scalar factors in products: println CollectScalars >> 'A_m*A^m*A_n*A^n'.t > (A_{m}*A^{m})**2 See [[documentation:ref:CollectScalars]].
====CollectNonScalars==== collects terms in sums with same tensorial parts: println CollectNonScalars >> 'A_m*A^m*A_n + A_n'.t > (1+A_{m}*A^{m})*A_{n} See [[documentation:ref:CollectNonScalars]].
====Conjugate==== replaces complex numbers in the expression with their complex conjugations: println Conjugate >> 'a + I*b'.t > a - I*b See [[documentation:ref:Conjugate]].
====Denominator==== gives the denominator of expression: println Denominator >> '(a + b)/(c + d)'.t > c + d See [[documentation:ref:Denominator]].
====Differentiate==== differentiates expressions with respect to specified variables: println Differentiate['x_a'] >> 'x_a*x^a - Sin[x_a*x^a]'.t > (2 - 2*Cos[x_{b}*x^{b}])*x^{a} See [[documentation:ref:Differentiate]].
====DiracSimplify==== simplifies products of gamma matrices: defineMatrices 'G_a', 'G5', Matrix1.matrix println DiracSimplify >> 'G5*G_a*G5*G_b*G^a*G^b'.t > -8 See [[documentation:ref:DiracSimpllify]].
====DiracOrder==== order products of gamma matrices: defineMatrices 'G_a', 'G5', Matrix1.matrix println DiracOrder >> 'G5*G_c*G_b*G_a'.t > G_{a}*G_{b}*G_{c}*G5+2*G_{b}*G5*g_{ca}-2*G_{c}*G5*g_{ba}-2*G_{a}*G5*g_{cb} See [[documentation:ref:DiracOrder]].
====DiracTrace==== evaluates trace of gamma matrices: defineMatrices 'G_m', 'G5', Matrix1.matrix println DiracTrace[[Gamma: 'G_m']] >> 'Tr[G_m*G_n]'.t > 4*g_{mn} See [[documentation:ref:DiracTrace]].
====EliminateDueSymmetries==== removes parts of expressions, which are zero because of the symmetries (symmetric and antisymmetric at the same time): println EliminateDueSymmetries >> '(A_mn - A_nm)*(A^mn + A^nm)'.t > 0 See [[documentation:ref:EliminateDueSymmetries]].
====EliminateMetrics==== eliminates metric tensors and kronecker deltas: println EliminateMetrics >> 'g_mn*A^m + d_n^a*B_a'.t > A_n + B_n See [[documentation:ref:EliminateMetrics]].
====ExpandAndEliminate==== expands out product of sums and positive integer powers and permanently eliminates metric and kronecker deltas: println ExpandAndEliminate >> '(g_mn - A_nm)*(A^mn + g^nm)'.t > -A^{mn}*A_{nm}+d^{n}_{n} See [[documentation:ref:ExpandAndEliminate]].
====Expand==== expands out products and positive integer powers: println Expand >> '(g_mn - A_nm)*(A^mn + g^nm)'.t > -A^{mn}*A_{nm}+g^{nm}*g_{mn} See [[documentation:ref:Expand]].
====ExpandAll==== expands out all products and integer powers in any part of expression: println ExpandAll >> '1/((g_mn - A_nm)*(A^mn + g^nm)').t > 1/(-A^{mn}*A_{nm}+g^{nm}*g_{mn}) See [[documentation:ref:ExpandAll]].
====ExpandDenominator==== expands out products and powers that appear in the numerator: println ExpandDenominator >> '(a + b)**2/(c + d)**2'.t > (a+b)**2/(c**2+d**2+2*d*c) See [[documentation:ref:ExpandDenominator]].
====ExpandNumerator==== expands out products and powers that appear as numerators: println ExpandNumerator >> '(a + b)**2/(c + d)**2'.t > (a**2+2*a*b+b**2)/(c+d)**2 See [[documentation:ref:ExpandNumerator]].
====ExpandTensors==== expands only indexed parts: println ExpandTensors >> '(a + b)**2*(A_a + B_a)*(A^a + B^a)'.t > (a+b)**2*A^{a}*A_{a}+2*(a+b)**2*A^{a}*B_{a}+(a+b)**2*B^{a}*B_{a} See [[documentation:ref:ExpandTensors]].
====FullyAntiSymmetrize==== symmetrizes expression with respect to all free indices println FullyAntiSymmetrize >> 'f_abc'.t > -(1/6)*f_{bac}+(1/6)*f_{bca}+(1/6)*f_{cab}-(1/6)*f_{acb}+(1/6)*f_{abc}-(1/6)*f_{cba} See [[documentation:ref: FullyAntiSymmetrize]].
====FullySymmetrize==== symmetrizes expression with respect to all free indices println FullySymmetrize >> 'f_abc'.t > (1/6)*f_{cba}+(1/6)*f_{bca}+(1/6)*f_{abc}+(1/6)*f_{acb}+(1/6)*f_{bac}+(1/6)*f_{cab} See [[documentation:ref: FullySymmetrize]].
====Factor==== factors a polynomial over the integers: println Factor >> 'x**2 - 2*x*y + y**2'.t > (x - y)**2 See [[documentation:ref:Factor]].
====Identity==== just identity: def expr = 'A_mn*(p^m + q^m) + T_n'.t assert Identity >> expr == expr
====InvertIndices==== inverts indices of expression: println InvertIndices >> 'A_mn*(p^m + q^m) + T_n'.t > A_m^n*(p^m + q^m) + T^n See [[documentation:ref: InvertIndices]].
====LeviCivitaSimplify==== simplifies combinations with Levi-Civita tensors: println LeviCivitaSimplify.minkowski['e_abcd'.t] >> 'e_abcm*e^abcn'.t > -6*d_{m}^{n} See [[documentation:ref: LeviCivitaSimplify]].
====Numerator==== gives the numerator of expression: println Numerator >> '(a + b)/(c + d)'.t > a + b See [[documentation:ref:Numerator]].
====Numeric==== gives the numerical value of expression: println Numeric >> 'Sin[2]'.t > 0.9092974268256817 See [[documentation:ref:Numeric]].
====PowerExpand==== expands all powers of products and powers with respect to specified variables: println PowerExpand >> '(a*b*c)**d'.t > a**d*b**d*c**d See [[documentation:ref:PowerExpand]].
====PowerUnfold==== expands all powers of products and powers with respect to specified variables and unfolds powers of indexed arguments into products: println PowerUnfold >> '(A_m*A^m)**2'.t > A_{m}*A^{m}*A_{a}*A^{a} See [[documentation:ref:PowerUnfold]].
====Reverse==== reverses the order of matrices of specified matrix type: defineMatrices 'A', 'B', 'C', Matrix1.matrix println Reverse[Matrix1] >> 'A*B*C'.t > C*B*A See [[documentation:ref:Reverse]].
====SpinorsSimplify==== simplifies Dirac spinors: defineMatrices 'G_a', 'G5', Matrix1.matrix, 'cu', Matrix1.covector def sSimplify = SpinorsSimplify[[uBar: 'cu', Momentum: 'p_a', Mass: 'm']] println sSimplify >> 'cu*G^a*p_a'.t > -m*cu*G_{b}+2*cu*p_{b} See [[documentation:ref:SpinorsSimplify]].
====Symmetrize==== gives a symmetrization of tensor with respect to specified indices under the specified symmetries: def indices = '_abc'.si indices.symmetries.setSymmetric() println Symmetrize[indices] >> 't_abc'.t > (1/6)*(t_{cab} + t_{acb} + t_{bca} + t_{cba} + t_{abc} + t_{bac}) See [[documentation:ref:Symmetrize]].
====Together==== puts terms in a sum over a common denominator, and cancels factors in the result: println Together >> '1/a + 1/b'.t > (a + b)/(a*b) See [[documentation:ref:Together]].
====UnitarySimplify==== simplifies combinations of unitary matrices and SU(N) structural and $d$-constants defineMatrices 'T_A', Matrix2.matrix println UnitarySimplify[[Matrix: 'T_A']] >> 'T_A*T^A'.t > (1/2)*N**(-1)*(N**2-1) See [[documentation:ref:UnitarySimplify]].
====UnitaryTrace==== evaluates trace of unitary matrices: defineMatrices 'T_A', Matrix2.matrix println UnitaryTrace[[Matrix: 'T_A']] >> 'Tr[T_A*T_B]'.t > (1/2)*g_{BA} See [[documentation:ref: UnitaryTrace]].