From ff48a4c31a23d98cc818e973e71010b7d5a97af6 Mon Sep 17 00:00:00 2001 From: Christian Bauer Date: Mon, 2 Aug 2004 22:07:02 +0000 Subject: [PATCH] added something about functions with variable number of arguments --- doc/tutorial/ginac.texi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/doc/tutorial/ginac.texi b/doc/tutorial/ginac.texi index 71912097..9c4d15ee 100644 --- a/doc/tutorial/ginac.texi +++ b/doc/tutorial/ginac.texi @@ -6307,6 +6307,24 @@ print_func() option which is explained in the next section. +@subsection Functions with a variable number of arguments + +The @code{DECLARE_FUNCTION} and @code{REGISTER_FUNCTION} macros define +functions with a fixed number of arguments. Sometimes, though, you may need +to have a function that accepts a variable number of expressions. One way to +accomplish this is to pass variable-length lists as arguments. The +@code{Li()} function uses this method for multiple polylogarithms. + +It is also possible to define functions that accept a different number of +parameters under the same function name, such as the @code{psi()} function +which can be called either as @code{psi(z)} (the digamma function) or as +@code{psi(n, z)} (polygamma functions). These are actually two different +functions in GiNaC that, however, have the same name. Defining such +functions is not possible with the macros but requires manually fiddling +with GiNaC internals. If you are interested, please consult the GiNaC source +code for the @code{psi()} function (@file{inifcns.h} and +@file{inifcns_gamma.cpp}). + @node Printing, Structures, Symbolic functions, Extending GiNaC @c node-name, next, previous, up -- 2.44.0