X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=doc%2Ftutorial%2Fginac.texi;h=f69d45107968ec0d2943d05179d43817aeb61efc;hp=f044d2c944ae00ceb6f5f1cdf1d146e3379a90d5;hb=a6bb52b00bf185271774e7d56215923700a3ec40;hpb=296ca653543d7b9ab1af2c4bbaa29f0783cee46e
diff --git a/doc/tutorial/ginac.texi b/doc/tutorial/ginac.texi
index f044d2c9..f69d4510 100644
--- a/doc/tutorial/ginac.texi
+++ b/doc/tutorial/ginac.texi
@@ -1105,8 +1105,16 @@ gamma(x+1/2) -> gamma(x+1/2)
gamma(15/2) -> (135135/128)*Pi^(1/2)
@end example
-Most of these functions can be differentiated, series expanded and so
-on. Read the next chapter in order to learn more about this.
+@cindex branch cut
+For functions that have a branch cut in the complex plane GiNaC follows
+the conventions for C++ as defined in the ANSI standard. In particular:
+the natural logarithm (@code{log}) and the square root (@code{sqrt})
+both have their branch cuts running along the negative real axis where
+the points on the axis itself belong to the upper part.
+
+Besides evaluation most of these functions allow differentiation, series
+expansion and so on. Read the next chapter in order to learn more about
+this.
@node Relations, Important Algorithms, Built-in functions, Basic Concepts
@@ -1425,10 +1433,14 @@ When you run it, it produces the sequence @code{1}, @code{-1}, @code{5},
@cindex Laurent expansion
Expressions know how to expand themselves as a Taylor series or (more
-generally) a Laurent series. Similar to 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 storing
-the order of the series. A sample program could read:
+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 storing the order
+of the series. As a consequence, if you want to work with series,
+i.e. multiply two series, you need to call the method @code{ex::series}
+again to convert it to a series object with the usual structure
+(expansion plus order term). A sample application from special
+relativity could read:
@example
#include
@@ -1436,25 +1448,28 @@ using namespace GiNaC;
int main()
@{
- symbol x("x");
- numeric point(0);
- ex MyExpr1 = sin(x);
- ex MyExpr2 = 1/(x - pow(x, 2) - pow(x, 3));
- ex MyTailor, MySeries;
+ symbol v("v"), c("c");
+
+ ex gamma = 1/sqrt(1 - pow(v/c,2));
+ ex mass_nonrel = gamma.series(v, 0, 10);
+
+ cout << "the relativistic mass increase with v is " << endl
+ << mass_nonrel << endl;
+
+ cout << "the inverse square of this series is " << endl
+ << pow(mass_nonrel,-2).series(v, 0, 10) << endl;
- MyTailor = MyExpr1.series(x, point, 5);
- cout << MyExpr1 << " == " << MyTailor
- << " for small " << x << endl;
- MySeries = MyExpr2.series(x, point, 7);
- cout << MyExpr2 << " == " << MySeries
- << " for small " << x << endl;
// ...
@}
@end example
+Only calling the series method makes the last output simplify to
+@math{1-v^2/c^2+O(v^10)}, without that call we would just have a long
+series raised to the power @math{-2}.
+
@cindex M@'echain's formula
-As an instructive application, let us calculate the numerical value of
-Archimedes' constant
+As another instructive application, let us calculate the numerical
+value of Archimedes' constant
@tex
$\pi$
@end tex