manpagez: man pages & more
info ginac
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.2.4 Functions with a variable number of arguments

The DECLARE_FUNCTION and 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 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 psi() function which can be called either as psi(z) (the digamma function) or as 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 psi() function (‘inifcns.h’ and ‘inifcns_gamma.cpp’).


© manpagez.com 2000-2024
Individual documents may contain additional copyright information.