[GiNaC-list] tensor manipulation....

Matt Bellis bellis at ernest.phys.cmu.edu
Fri Aug 6 14:47:03 CEST 2004

Hi ginac'ers,

	Brand new to this, so sorry if this is old hat. Couldn't find it 
in the archives. 

	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. I've got this for now. 


using namespace std;
using namespace GiNaC;

int main()
  symbol mu_sym("mu");
  varidx mu(mu_sym, 4);

  symbol p1_sym("p1");
  ex p1 = indexed(p1_sym, mu);
  symbol p2_sym("p2");
  ex p2 = indexed(p2_sym, mu.toggle_variance());

  ex mass = p1 * p2;
  cerr << mass << endl;

  return 0;

	It looks OK, but I need to be able to enter in data for p1 and 
p2 so I can calculate the mass. I don't know how to do this. Anyone know?

	Also, right now I've got two separate expressions for the raised 
and lowered indices of the momentum (p1, p2). Is there an easier way to do 

	Thanks in advance for any help anyone can offer. 

Matt Bellis
Carnegie Mellon University
(office) 412-268-6949
(cell)	 412-310-4586

More information about the GiNaC-list mailing list