Table of Contents

List of common transformations


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 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 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 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 CollectNonScalars.


Conjugate

replaces complex numbers in the expression with their complex conjugations:

println Conjugate >> 'a + I*b'.t
   > a - I*b
See Conjugate.


Denominator

gives the denominator of expression:

println Denominator >> '(a + b)/(c + d)'.t
   > c + d
See 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 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 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 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 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 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 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 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 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 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 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 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 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 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 FullySymmetrize.


Factor

factors a polynomial over the integers:

println Factor >> 'x**2 - 2*x*y + y**2'.t
   > (x - y)**2
See 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 InvertIndices.


LeviCivitaSimplify

simplifies combinations with Levi-Civita tensors:

println LeviCivitaSimplify.minkowski['e_abcd'.t] >> 'e_abcm*e^abcn'.t
   > -6*d_{m}^{n}
See LeviCivitaSimplify.


Numerator

gives the numerator of expression:

println Numerator >> '(a + b)/(c + d)'.t
   > a + b
See Numerator.


Numeric

gives the numerical value of expression:

println Numeric >> 'Sin[2]'.t
   > 0.9092974268256817
See 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 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 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 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 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 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 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 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 UnitaryTrace.