manpagez: man pages & more
info ginac
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.11 Symmetrization

The three methods

 
ex ex::symmetrize(const lst & l);
ex ex::antisymmetrize(const lst & l);
ex ex::symmetrize_cyclic(const lst & l);

symmetrize an expression by returning the sum over all symmetric, antisymmetric or cyclic permutations of the specified list of objects, weighted by the number of permutations.

The three additional methods

 
ex ex::symmetrize();
ex ex::antisymmetrize();
ex ex::symmetrize_cyclic();

symmetrize or antisymmetrize an expression over its free indices.

Symmetrization is most useful with indexed expressions but can be used with almost any kind of object (anything that is subs()able):

 
{
    idx i(symbol("i"), 3), j(symbol("j"), 3), k(symbol("k"), 3);
    symbol A("A"), B("B"), a("a"), b("b"), c("c");
                                           
    cout << indexed(A, i, j).symmetrize() << endl;
     // -> 1/2*A.j.i+1/2*A.i.j
    cout << indexed(A, i, j, k).antisymmetrize(lst(i, j)) << endl;
     // -> -1/2*A.j.i.k+1/2*A.i.j.k
    cout << lst(a, b, c).symmetrize_cyclic(lst(a, b, c)) << endl;
     // -> 1/3*{a,b,c}+1/3*{b,c,a}+1/3*{c,a,b}
}

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.