Hi! 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 http://down.physik.uni-mainz.de/cgi-bin/viewcvs.cgi/xloops/lib/?cvsroot=ThEP 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; Bye, Christian -- / Physics is an algorithm \/ http://www.uni-mainz.de/~bauec002/