[GiNaC-list] tensor manipulation....

Christian Bauer Christian.Bauer at uni-mainz.de
Fri Aug 6 19:07:04 CEST 2004


On Thu, Aug 05, 2004 at 03:19:07AM -0400, Matt Bellis wrote:
> 	I want to do some simple calculations involving 4-momenta and 
> dirac matrices. Simplest case I want to get the invariant mass of a 
> 4-momentum.

xloops has a momentum class where you can assign components or invariants
(or not), and do calculations with it. See


files "momentum.cpp" and "momentum.h".

For example, you can write

    momentum p(symbol("p"));
    p.assign(1938.0, 1696.0, 0, 0); // E and \sqrt(\vec{p}^2) in MeV

    // with indices
    varidx mu(symbol("mu"), 4);
    ex mass_sq = indexed(p, mu) * indexed(p, mu.toggle_variance());
    cout << sqrt(simplify_indexed(mass_sq)) << endl;

    // easier, without indices
    cout << sqrt(p.get_square()) << endl;


  / Physics is an algorithm
\/ http://www.uni-mainz.de/~bauec002/

More information about the GiNaC-list mailing list