[GiNaC-list] Non commutative symbols ?

ahabrard amaury.habrard at lif.univ-mrs.fr
Mon Jun 29 18:41:14 CEST 2009


We are new to the Ginac community and we want to manipulate non commutative

We didn't find how to declare non commutative symbols in the tutorial and
we found this on the web:

const unsigned  tinfo=2;
symbol x("x", return_types::noncommutative,&tinfo)

But we don't know if this declaration is correct ?
We will appreciate any documentation on using non commutative symbols.

We tried the following code:

  const unsigned  tinfo=2;
  symbol x("x", return_types::noncommutative,&tinfo);
  symbol y("y",return_types::noncommutative,&tinfo);
  cout << x*y+y*x+x*y << endl;
  cout << x/x << endl;
  cout << x*pow(x,-1) << endl;

The first expression works fine, however the last two expressions are not
simplified to the neutral element.
Is there anyone who knows the reason ?

Another problem with matrix of non commutative symbols, consider the
following code:
 matrix m(2,2);
 m = x, y, y, x;
 cout << m.inverse() << endl;

Ginac stops with the following message:
"Terminate called after throwing an instance of 'std::logic_error'
  what():  add::eval(): sum of non-commutative objects has non-zero numeric
Abort trap"

Anyone knows the reason ?

Thanks in advance for your help.

Best regards,
View this message in context: http://www.nabble.com/Non-commutative-symbols---tp24257628p24257628.html
Sent from the Ginac - General mailing list archive at Nabble.com.

More information about the GiNaC-list mailing list