X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=doc%2Ftutorial%2Fginac.texi;h=dbbf2359e76764aad30e1615fb08a66d38d2b782;hp=236d98ddeb93b61c477e6bb48cac78c2591245ec;hb=9cd8ed658fbc4b8c50b40e1db770462526dfb806;hpb=4e53a7554e39c687b6cf467af3c967760ce3a521 diff --git a/doc/tutorial/ginac.texi b/doc/tutorial/ginac.texi index 236d98dd..dbbf2359 100644 --- a/doc/tutorial/ginac.texi +++ b/doc/tutorial/ginac.texi @@ -24,7 +24,7 @@ This is a tutorial that documents GiNaC @value{VERSION}, an open framework for symbolic computation within the C++ programming language. -Copyright (C) 1999-2011 Johannes Gutenberg University Mainz, Germany +Copyright (C) 1999-2015 Johannes Gutenberg University Mainz, Germany Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -52,7 +52,7 @@ notice identical to this one. @page @vskip 0pt plus 1filll -Copyright @copyright{} 1999-2011 Johannes Gutenberg University Mainz, Germany +Copyright @copyright{} 1999-2015 Johannes Gutenberg University Mainz, Germany @sp 2 Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -135,7 +135,7 @@ the near future. @section License The GiNaC framework for symbolic computation within the C++ programming -language is Copyright @copyright{} 1999-2011 Johannes Gutenberg +language is Copyright @copyright{} 1999-2015 Johannes Gutenberg University Mainz, Germany. This program is free software; you can redistribute it and/or @@ -476,7 +476,7 @@ installation. In order to install GiNaC on your system, some prerequisites need to be met. First of all, you need to have a C++-compiler adhering to the -ANSI-standard @cite{ISO/IEC 14882:1998(E)}. We used GCC for development +ISO standard @cite{ISO/IEC 14882:2011(E)}. We used GCC for development so if you have a different compiler you are on your own. For the configuration to succeed you need a Posix compliant shell installed in @file{/bin/sh}, GNU @command{bash} is fine. The pkg-config utility is @@ -3334,7 +3334,7 @@ Clifford algebras, which will commute with each other. Note that the call @code{clifford_unit(mu, minkmetric())} creates something very close to @code{dirac_gamma(mu)}, although @code{dirac_gamma} have more efficient simplification mechanism. -@cindex @code{clifford::get_metric()} +@cindex @code{get_metric()} The method @code{clifford::get_metric()} returns a metric defining this Clifford number. @@ -5858,6 +5858,9 @@ GiNaC contains the following predefined mathematical functions: @item @code{log(x)} @tab natural logarithm @cindex @code{log()} +@item @code{eta(x,y)} +@tab Eta function: @code{eta(x,y) = log(x*y) - log(x) - log(y)} +@cindex @code{eta()} @item @code{Li2(x)} @tab dilogarithm @cindex @code{Li2()} @@ -6502,7 +6505,7 @@ to map input (sub)strings to arbitrary expressions: table["x"] = x+log(y)+1; parser reader(table); ex e = reader("5*x^3 - x^2"); - // e = 5*(x+log(y)+1)^3 + (x+log(y)+1)^2 + // e = 5*(x+log(y)+1)^3 - (x+log(y)+1)^2 @} @end example @@ -6515,8 +6518,8 @@ with @code{get_syms()} method: parser reader; ex e = reader("2*x+sin(y)"); symtab table = reader.get_syms(); - symbol x = reader["x"]; - symbol y = reader["y"]; + symbol x = ex_to(table["x"]); + symbol y = ex_to(table["y"]); @} @end example @@ -6689,7 +6692,13 @@ ones supplied to @code{compile_ex} should appear in the expression. @code{compile_ex} uses the shell script @code{ginac-excompiler} to start the C compiler and produce the object files. This shell script comes with GiNaC and will be installed together with GiNaC in the configured @code{$PREFIX/bin} -directory. +directory. You can also export additional compiler flags via the $CXXFLAGS +variable: + +@example +setenv("CXXFLAGS", "-O3 -fomit-frame-pointer -ffast-math", 1); +compile_ex(...); +@end example @subsection Archiving @cindex @code{archive} (class) @@ -7100,6 +7109,25 @@ specifies which parameter to differentiate in a partial derivative in case the function has more than one parameter, and its main application is for correct handling of the chain rule. +Derivatives of some functions, for example @code{abs()} and +@code{Order()}, could not be evaluated through the chain rule. In such +cases the full derivative may be specified as shown for @code{Order()}: + +@example +static ex Order_expl_derivative(const ex & arg, const symbol & s) +@{ + return Order(arg.diff(s)); +@} +@end example + +That is, we need to supply a procedure, which returns the expression of +derivative with respect to the variable @code{s} for the argument +@code{arg}. This procedure need to be registered with the function +through the option @code{expl_derivative_func} (see the next +Subsection). In contrast, a partial derivative, e.g. as was defined for +@code{cos()} above, needs to be registered through the option +@code{derivative_func}. + An implementation of the series expansion is not needed for @code{cos()} as it doesn't have any poles and GiNaC can do Taylor expansion by itself (as long as it knows what the derivative of @code{cos()} is). @code{tan()}, on @@ -7135,14 +7163,15 @@ functions without any special options. eval_func() evalf_func() derivative_func() +expl_derivative_func() series_func() conjugate_func() @end example These specify the C++ functions that implement symbolic evaluation, -numeric evaluation, partial derivatives, and series expansion, respectively. -They correspond to the GiNaC methods @code{eval()}, @code{evalf()}, -@code{diff()} and @code{series()}. +numeric evaluation, partial derivatives, explicit derivative, and series +expansion, respectively. They correspond to the GiNaC methods +@code{eval()}, @code{evalf()}, @code{diff()} and @code{series()}. The @code{eval_func()} function needs to use @code{.hold()} if no further automatic evaluation is desired or possible. @@ -8405,14 +8434,9 @@ fix bugs in a traditional system. multiple interfaces: Though real GiNaC programs have to be written in some editor, then be compiled, linked and executed, there are more ways to work with the GiNaC engine. Many people want to play with -expressions interactively, as in traditional CASs. Currently, two such -windows into GiNaC have been implemented and many more are possible: the -tiny @command{ginsh} that is part of the distribution exposes GiNaC's -types to a command line and second, as a more consistent approach, an -interactive interface to the Cint C++ interpreter has been put together -(called GiNaC-cint) that allows an interactive scripting interface -consistent with the C++ language. It is available from the usual GiNaC -FTP-site. +expressions interactively, as in traditional CASs: The tiny +@command{ginsh} that comes with the distribution exposes many, but not +all, of GiNaC's types to a command line. @item seamless integration: it is somewhere between difficult and impossible @@ -8463,8 +8487,7 @@ really believe that you need to use a different compiler. We have occasionally used other compilers and may be able to give you advice.} GiNaC uses recent language features like explicit constructors, mutable members, RTTI, @code{dynamic_cast}s and STL, so ANSI compliance is meant -literally. Recent GCC versions starting at 2.95.3, although itself not -yet ANSI compliant, support all needed features. +literally. @end itemize @@ -8885,7 +8908,7 @@ $ make install @itemize @minus{} @item -@cite{ISO/IEC 14882:1998: Programming Languages: C++} +@cite{ISO/IEC 14882:2011: Programming Languages: C++} @item @cite{CLN: A Class Library for Numbers}, @email{haible@@ilog.fr, Bruno Haible}