[GiNaC-list] Don't do mix tensors and matrices (Was: How to convert epsilon_tensor in a matrix?)

Alexei Sheplyakov alexei.sheplyakov at gmail.com
Sun Feb 26 17:54:30 CET 2012


Hello,

On Sun, Feb 26, 2012 at 12:06:37PM -0300, Marco André Ferreira Dias wrote:
 
> I have a very naive question: my program compute some dirac_traces, and
> some epsilon_tensors arises in this process. I have to convert the
> tensorial structure to matricial

I don't think it's a good idea (see http://www.ginac.de/FAQ.html#matrix_indexed)

> to compute it numerically

And I don't think it's necessary for numeric computation.

> but until now I don't figure out how to manipulate expressions like this
> =============
> [[31],[0.0],[0.0],[-31]]~sigma*[[6.3],[0.0],[0.0],[6.30]]~alpha*
> [[19.33],[-1.108],[-5.4],[18.6]].gamma*eps.delta.sigma~gamma.alpha*
> [[16.781197650788506337],[4.96],[11.38],[11.2]]~gamma
> =============

Don't convert tensor expressions to matrices, instead express them via
invariant quantities, like this:

#include <iostream>
#include <ginac/ginac.h>
using namespace std;
using namespace GiNaC;

int main()
{
	symbol q("q"), l("l"), m("m"), ldotq("ldotq"), D("D");
	varidx mu(symbol("mu"), D), nu(symbol("nu"), D);

	scalar_products sp;
	sp.add(l, l, pow(l, 2));
	sp.add(l, q, ldotq);

	ex e = dirac_gamma(mu)*
		(dirac_slash(l, D) + dirac_slash(q, D) + m*dirac_ONE())*
		dirac_gamma(mu.toggle_variance())*
		(dirac_slash(l, D) + m*dirac_ONE());
	e = dirac_trace(e).simplify_indexed(sp);
	e = e.collect(lst(l, ldotq, m));
	cout << e << endl;
	// -> (8-4*D)*l^2+(8-4*D)*ldotq+4*D*m^2
	return 0;
}


See the fine manual (specifically, the paragraph 4.15.1.1, titled as
`Dirac gamma matrices') for more details.

Hope this helps,
	Alexei



More information about the GiNaC-list mailing list