====== Symmetrize ======
----
====Description====
* ''Symmetrize[indices]'' makes expression symmetries same to the symmetries of ''indices''
* ''Symmetrize[indices]'' makes expression symmetric only with respect to specified indices
* ''Symmetrize[indices]'' will also multiply the result on the symmetric factor
====Examples====
----
Symmetrize indices ''a'' and ''b'' in expression:
def indices = '_ab'.si
indices.symmetries.setSymmetric()
println Symmetrize[indices] >> 'T_ab'.t
> T_{ab}/2 + T_{ba}/2
Antisymmetrize indices ''a'' and ''b'' in expression:
def indices = '_ab'.si
indices.symmetries.setAntiSymmetric()
println Symmetrize[indices] >> 'T_ab'.t
> T_{ab}/2 - T_{ba}/2
----
Symmetrize a complicated expression
def indices = '_ab'.si
indices.symmetries.setAntiSymmetric()
println Symmetrize[indices] >> 'T_ac*F^c_b - F_bc*T^c_a'.t
> T_{ac}*F^{c}_{b}/2-T_{bc}*F^{c}_{a}/2-T^{c}_{a}*F_{bc}/2+T^{c}_{b}*F_{ac}/2
----
Symmetrize part of indices
def indices = '_abc'.si
indices.symmetries.setSymmetric()
println Symmetrize[indices] >> 'T_abcde'.t
> T_{bcade}/6+T_{cabde}/6+T_{cbade}/6+T_{abcde}/6+T_{acbde}/6+T_{bacde}/6
----
Make symmetries equal to specified permutation group
def indices = '_abcd'.si
indices.symmetries.add(-[1, 0].p)
indices.symmetries.add([2, 3, 0, 1].p)
println Symmetrize[indices] >> '8*R_abcd'.t
> -R_{abdc}-R_{dcab}-R_{cdba}+R_{badc}+R_{dcba}+R_{cdab}+R_{abcd}-R_{bacd}
----
''Symmetrize'' will have no effect if tensor already has such symmetries:
setSymmetric 'F_abcd'
def indices = '_bcd'.si
indices.symmetries.add([1, 0, 2].p)
println Symmetrize[indices] >> 'F_abcd'.t
> F_{abdc}
----
====Details====
----
Symmetries are defined relatively to the specified indices:
def indices = '_abc'.si
indices.symmetries.add([1, 0, 2].p)
println Symmetrize[indices] >> 'F_abc'.t
> (1/2)*F_{bac}+(1/2)*F_{abc}
indices = '_cab'.si
indices.symmetries.add([1, 0, 2].p)
println Symmetrize[indices] >> 'F_abc'.t
> (1/2)*F_{abc}+(1/2)*F_{cba}
----
Implement transformation that makes expression fully symmetric with respect to all indices:
def Symmetric = { expr ->
def indices = expr.indices.si //convert indices of expr to simple indices
indices.symmetries.setSymmetric()
return Symmetrize[indices] >> expr
} as Transformation
println Symmetric >> '6*f_abc'.t
> f_{cab}+f_{acb}+f_{abc}+f_{cba}+f_{bac}+f_{bca}
Same for fully antisymmetric transformation:
def AntiSymmetric = { expr ->
def indices = expr.indices.si //convert indices of expr to simple indices
indices.symmetries.setAntiSymmetric()
return Symmetrize[indices] >> expr
} as Transformation
println AntiSymmetric >> '6*f_abc'.t
> f_{bca}+f_{cab}-f_{cba}-f_{bac}+f_{abc}-f_{acb}
----
====See also====
* Related guides: [[documentation:guide:applying_and_manipulating_transformations]], [[documentation:guide:symmetries_of_tensors]], [[documentation:guide:tensors_and_indices]], [[documentation:guide:list_of_transformations]]
* Related transformations: [[documentation:ref:fullysymmetrize]], [[documentation:ref:fullyantisymmetrize]]
* JavaDocs: [[http://api.redberry.cc/redberry/1.1.9/java-api/cc/redberry/core/transformations/symmetrization/SymmetrizeTransformation.html| SymmetrizeTransformation]]
* Source code: [[https://bitbucket.org/redberry/redberry/src/tip/core/src/main/java/cc/redberry/core/transformations/symmetrization/SymmetrizeTransformation.java|SymmetrizeTransformation.java]]