Should I subscribe to the dev-list? Here is a correction and a suggestion in the patch, the latter just a hint what errors are being made by newbies. If you don't like it, reformulate. ralf --- ginac.texi.orig Mon Mar 15 18:47:17 2004 +++ ginac.texi Thu Jun 10 19:21:26 2004 @@ -4293,7 +4293,7 @@ @example @{ - symbol a("a"), b("b"), c("c"); + symbol a("a"), b("b"), c("c"), x("x"); idx i(symbol("i"), 3); ex e = pow(sin(x) - cos(x), 4); @@ -4309,6 +4309,34 @@ @} @end example +This is a good place to remind you that symbols are not uniquely identified +by their string representation but by the C++ variable they were assigned to. +This means that the first of the following two examples will not output 6 +but 0: + +@example +@{ + ex f(int n) @{ symbol x("x"); return pow(x+1,n); @} + ... + symbol x("x"); + ... + cout << f(6).degree(x) << endl; // WRONG +@} +@end example + +For clarity, efficiency, and modularity, it should have been coded: + +@example +@{ + ex f(int n, symbol& x) @{ return pow(x+1,n); @} + ... + symbol x("x"); + ... + cout << f(6,x).degree(x) << endl; // RIGHT +@} +@end example + + @subsection Polynomial division @cindex polynomial division