Hi Alexei,<div><br></div><div>thanks for your advice. I've changed my code, implementing all in the scalar products, instead using matrices explicitly. But epsilon tensor fully contracted with vectors still being a problem, since its isn't transformable in the ordinary product of this vectors. </div>
<div>My problem is after compute a expression use it to do a Monte Carlo integration of this values.</div><div>Regards,</div><div><br></div><div>Marco <br><br><div class="gmail_quote">On Sun, Feb 26, 2012 at 1:54 PM, Alexei Sheplyakov <span dir="ltr"><<a href="mailto:alexei.sheplyakov@gmail.com">alexei.sheplyakov@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
On Sun, Feb 26, 2012 at 12:06:37PM -0300, Marco André Ferreira Dias wrote:<br>
<br>
> I have a very naive question: my program compute some dirac_traces, and<br>
> some epsilon_tensors arises in this process. I have to convert the<br>
> tensorial structure to matricial<br>
<br>
I don't think it's a good idea (see <a href="http://www.ginac.de/FAQ.html#matrix_indexed" target="_blank">http://www.ginac.de/FAQ.html#matrix_indexed</a>)<br>
<br>
> to compute it numerically<br>
<br>
And I don't think it's necessary for numeric computation.<br>
<br>
> but until now I don't figure out how to manipulate expressions like this<br>
> =============<br>
> [[31],[0.0],[0.0],[-31]]~sigma*[[6.3],[0.0],[0.0],[6.30]]~alpha*<br>
> [[19.33],[-1.108],[-5.4],[18.6]].gamma*eps.delta.sigma~gamma.alpha*<br>
> [[16.781197650788506337],[4.96],[11.38],[11.2]]~gamma<br>
> =============<br>
<br>
Don't convert tensor expressions to matrices, instead express them via<br>
invariant quantities, like this:<br>
<br>
#include <iostream><br>
#include <ginac/ginac.h><br>
using namespace std;<br>
using namespace GiNaC;<br>
<br>
int main()<br>
{<br>
        symbol q("q"), l("l"), m("m"), ldotq("ldotq"), D("D");<br>
        varidx mu(symbol("mu"), D), nu(symbol("nu"), D);<br>
<br>
        scalar_products sp;<br>
        sp.add(l, l, pow(l, 2));<br>
        sp.add(l, q, ldotq);<br>
<br>
        ex e = dirac_gamma(mu)*<br>
                (dirac_slash(l, D) + dirac_slash(q, D) + m*dirac_ONE())*<br>
                dirac_gamma(mu.toggle_variance())*<br>
                (dirac_slash(l, D) + m*dirac_ONE());<br>
        e = dirac_trace(e).simplify_indexed(sp);<br>
        e = e.collect(lst(l, ldotq, m));<br>
        cout << e << endl;<br>
        // -> (8-4*D)*l^2+(8-4*D)*ldotq+4*D*m^2<br>
        return 0;<br>
}<br>
<br>
<br>
See the fine manual (specifically, the paragraph 4.15.1.1, titled as<br>
`Dirac gamma matrices') for more details.<br>
<br>
Hope this helps,<br>
        Alexei<br>
<br>
</blockquote></div><br></div>