# Differences

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

 documentation:guide:list_of_transformations [2015/11/21 11:03]poslavskysv documentation:guide:list_of_transformations [2015/11/21 12:33] Line 1: Line 1: - ====== List of common transformations ====== - <​html>​ -
- ​ - Next topic: [[documentation:​guide:​overview_of_hep_features]] - <​html>​ - ​ - ​ - ​ - ---- - Here is a list of basic transformations available in Redberry: - - - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - ====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]] . - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - ====Conjugate==== - replaces complex numbers in the expression with their complex conjugations:​ - - println Conjugate >> 'a + I*b'.t - ​ - - > a - I*b - ​ - See [[documentation:​ref:​Conjugate]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">  ​ - ====Denominator==== - gives the denominator of expression: - - println Denominator >> '(a + b)/(c + d)'.t - ​ - - > c + d - ​ - See [[documentation:​ref:​Denominator]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">  ​ - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">  ​ - - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">  ​ - - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">  ​ - - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">  ​ - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - ====EliminateMetrics==== - eliminates metric tensors and kronecker deltas: - - println EliminateMetric >> '​g_mn*A^m + d_n^a*B_a'​.t - ​ - - > A_n + B_n - ​ - See [[documentation:​ref:​EliminateMetrics]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - - ====Factor==== - factors a polynomial over the integers: - - println Factor >> 'x**2 - 2*x*y + y**2'​.t - ​ - - > (x - y)**2 - ​ - See [[documentation:​ref:​Factor]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - ====Identity==== - just identity: - - def expr = '​A_mn*(p^m + q^m) + T_n'.t - assert Identity >> expr == expr - ​ - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - ====Numerator==== - gives the numerator of expression: - - println Numerator >> '(a + b)/(c + d)'.t - ​ - - > a + b - ​ - See [[documentation:​ref:​Numerator]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - ====Numeric==== - gives the numerical value of expression: - - println Numeric >> '​Sin[2]'​.t - ​ - - > 0.9092974268256817 - ​ - See [[documentation:​ref:​Numeric]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">​ - ====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]]. - - <​html><​hr style="​border:​dashed #555555; border-width:​1px 0 0; height:​0;">