[GiNaC-list] Simplifying indexed expressions not working on multi-indices scalar_product

Alejandro Limache alejandrolimache at hotmail.com
Wed Jul 26 17:58:12 CEST 2006


According to section 4.14.5 "Simplifying indexed expressions" of the 
tutorial,
if I set:
         scalar_products sp;
         sp.add(A, B, 0);
then:
        A~mu~nu*B.mu.nu
should be replaced by zero when using .simplify_indexed(sp).
This is not working. See my simple code below.

Is this a bug?, any help will be appreciated
Alejandro

PS. I am using Ginac version 1.3.4 on debian this are the rpm I've got:
ginac-tools_1.3.4-1_i386.deb
libginac1.3c2a_1.3.4-1_i386.deb
libginac-dev_1.3.4-1_i386.deb

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#include <iostream>
#include <ginac/ginac.h>

using namespace std;
using namespace GiNaC;
int main (void)
{
    symbol A("A"),B("B"),mu_sym("mu"),nu_sym("nu");
    idx mu(mu_sym,3), nu(nu_sym,3);
    ex e, e1;
    scalar_products sp;
    sp.add(A,B,0);
    cout << "scalar_prod 1 index:" << endl;
    e= indexed(A,mu)*indexed(B,mu);
    cout <<e <<endl;
    cout << e.simplify_indexed(sp) << "  ==> correct " << endl;


    cout << "scalar_prod 2 indices:" << endl;
    e1= indexed(A,mu,nu)*indexed(B,mu,nu);
    cout << e1 <<endl;
    cout << e1.simplify_indexed(sp) << "  ==> wrong, it is not zero" << 
endl;

    return 0;
}




More information about the GiNaC-list mailing list