From: Christian Bauer Date: Fri, 25 May 2001 22:29:34 +0000 (+0000) Subject: mentioned ncpow() X-Git-Tag: release_0-9-0~34 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=76e316dae12aac0216a0d7f701e35911240b5d5c;hp=316405c8b75a62d2ae63074bfd3a60c6661bfbbb mentioned ncpow() --- diff --git a/doc/tutorial/ginac.texi b/doc/tutorial/ginac.texi index 12d7035d..c5841b8a 100644 --- a/doc/tutorial/ginac.texi +++ b/doc/tutorial/ginac.texi @@ -1970,6 +1970,16 @@ Other representation labels yield a different @code{return_type_tinfo()}, but it's the same for any two objects with the same label. This is also true for color objects. +As a last note, powers of non-commutative objects are not allowed in GiNaC. +You can use the function + +@example +ex ncpow(const ex & basis, unsigned exponent) +@end example + +instead which returns an expanded product (e.g. @code{ncpow(a*b, 2)} becomes +@samp{a*b*a*b} if @samp{a} and @samp{b} are non-commutative expressions). + @cindex @code{clifford} (class) @subsection Clifford algebra @@ -2799,7 +2809,7 @@ The last example would be written in C++ in this way: e = a*pow(sin(x+y), 2) + a*pow(cos(x+y), 2) + b; e = e.subs(pow(cos(wild()), 2) == 1-pow(sin(wild()), 2)); cout << e.expand() << endl; - // -> "b+a" + // -> a+b @} @end example