Hello, We are new to the Ginac community and we want to manipulate non commutative symbols. 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 term Abort trap" Anyone knows the reason ? Thanks in advance for your help. Best regards, Amaury -- 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.
Hello,
On Mon, 29 Jun 2009 09:41:14 -0700 (PDT), ahabrard <amaury.habrard@lif.univ-mrs.fr> said: A> const unsigned tinfo=2; symbol x("x", A> return_types::noncommutative,&tinfo)
Which version of GiNaC you are using, 1.4 branch I suppose? This code is not working with the current 1.5 branch. Moreover I could not figure out how to make non-commutative symbols at the moment, probably a patch is required for this. What other developers think, shall we simply add a new class ncsymbol derived from symbol? A> Ginac stops with the following message: "Terminate called after A> throwing an instance of 'std::logic_error' A> what(): add::eval(): sum of non-commutative objects has A> non-zero numeric A> term Abort trap" GiNaC seems to forbid to make matrices out of non-commutative object in order to avoid complications with nested non-commutativities. If you know that you want you may need to derive a new class from matrices to handle it. Best wishes, Vladimir -- Vladimir V. Kisil email: kisilv@maths.leeds.ac.uk -- www: http://maths.leeds.ac.uk/~kisilv/
Hi! ahabrard wrote:
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 term Abort trap"
Anyone knows the reason ?
Internally, the .inverse() method is performing matrix elimination. With non-commutative elements, it would have to keep track of the order of terms but it doesn't really know how to do that. If you know how to do such things, you should consider writing a patch. Cheers -richy. -- Richard B. Kreckel <http://www.ginac.de/~kreckel/>
participants (3)
-
ahabrard
-
Richard B. Kreckel
-
Vladimir V. Kisil