From 15f428efcdf71665f99f2b08432c1566dda5835f Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Wed, 10 Nov 1999 23:47:17 +0000 Subject: [PATCH] Fixed 50 percent of the bugs on Alex' list. More, soon... --- doc/tutorial.sgml.in | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/doc/tutorial.sgml.in b/doc/tutorial.sgml.in index 5d351533..cd8b053b 100644 --- a/doc/tutorial.sgml.in +++ b/doc/tutorial.sgml.in @@ -243,7 +243,9 @@ allow one to conclude that 42*Pi is equal to 0.) Linear equation systems can be solved along with basic linear -algebra manipulations over symbolic expressions: +algebra manipulations over symbolic expressions. In C++ there is a +matrix class for this purpose but we can see what it can do using +ginsh's notation of double brackets to type them in: > lsolve(a+x*y==z,x); y^(-1)*(z-a); @@ -692,7 +694,7 @@ catch in here having to do with the fact that C++ is a compiled language. The information about the symbol's name is thrown away by the compiler but at a later stage you may want to print expressions holding your symbols. In order to avoid confusion GiNaC's symbols are -able to know their own name. This is accompilshed by declaring its +able to know their own name. This is accomplished by declaring its name for output at construction time in the fashion symbol x("x");. @@ -977,7 +979,7 @@ int main() x squared. This direct construction is necessary since we cannot safely overload the constructor ^ in C++ to construct a power -object. If we did, it would have two counterintuitive effects: +object. If we did, it would have several counterintuitive effects: Due to C's operator precedence, @@ -985,16 +987,26 @@ object. If we did, it would have two counterintuitive effects: Due to the binding of the operator ^, - x^2^3 would result in x^8. + x^a^b would result in (x^a)^b. This would be confusing since most (though not all) other CAS - interpret this as x^6. + interpret this as x^(a^b). + + + Also, expressions involving integer exponents are very + frequently used, which makes it even more dangerous to overload + ^ since it is then hard to distinguish between the + semantics as exponentiation and the one for exclusive or. (It would + be embarassing to return 1 where one has requested + 2^3.) -Both effects are contrary to mathematical notation and differ from the +All effects are contrary to mathematical notation and differ from the way most other CAS handle exponentiation, therefore overloading -^ is ruled out. (Also note, that the other -frequently used exponentiation operator ** does not -exist at all in C++). +^ is ruled out for GiNaC's C++ part. The situation +is different in ginsh, there the +exponentiation-^ exists. (Also note, that the +other frequently used exponentiation operator ** +does not exist at all in C++). To be somewhat more precise, objects of the three classes described here, are all containers for other expressions. An object @@ -1102,8 +1114,9 @@ can be repeated. In our expample, two possibilies would be To bring an expression into expanded form, its method .expand() may be called. In our example above, this corresponds to 4*x*y + x*z + 20*y^2 + 21*y*z + -4*z^2. There is no canonical form in GiNaC. Be prepared to -see different orderings of terms in such sums! +4*z^2. Again, since the canonical form in GiNaC is not +easily guessable you should be prepared to see different orderings of +terms in such sums! @@ -1267,7 +1280,7 @@ int main() Series Expansion -Expressions know how to expand themselfes as a Taylor series or +Expressions know how to expand themselves as a Taylor series or (more generally) a Laurent series. As in most conventional Computer Algebra Systems no distinction is made between those two. There is a class of its own for storing such series as well as a class for -- 2.49.0