[GiNaC-devel] new function system
Richard B. Kreckel
kreckel at ginac.de
Sat Nov 26 23:15:23 CET 2005
Hi Jens,
Jens Vollinga wrote:
>
> Why should the user have to learn another convention (as stated above
> under b)) if all the classes have the same name as the current functions?
Oh, you aren't proposing logGamma, etc. any more? Good. (And, please
excuse my misunderstanding you.)
>
> Why is it fine to disambiguate just in case of integral types (see
> question below)? sin(1) doesn't disambiguate currently when one
> includes cmath!!
Well, I was just suggesting to disambiguate the common cases like ex
sin(int) in order to reduce the number of surprises. What else could
one override? ex sin(double)? No! That would really conflict with
cmath's declaration. (Note that CLN has sin(own types), as have many
other such libraries).
>
> Does it really make sense to have sin(1) or zeta(2) evaled on creation
> (by means of a special function)? I remember having to 'tweak' zeta a
> little bit to not throw an exception when the argument is 1.
You mean: to actually _throw_ an exception, I suppose?
> And with the polylogs I often have to use a lot of .holds() just
> because I don't want the automatic evaluation in intermediate
> expressions. And isn't there an issue with 1/tgamma(-n) ...?
What issue? Limits are quite another story, aren't they?
> Maybe a solution to this is easier without the automatic evaluation on
> creation.
> To have automatic evaluation just on assignment might (I am not sure
> though, please teach me!) be more clear, powerful, ...
I don't understand: Each class has two evaluations: ctor and eval. The
ctor cannot do everything because it is contrained to a specific class.
The eval member functions, in contrast, have more leeway with the
general ex they return. The intent was to do as much term rewriting as
possible in the ctors, and do as much term rewriting as reasonable in
the eval member functions. Maybe that is questionable, I don't know.
However, all this doesn't hold for our functions, does it? We have
sin(ex) invoking the ctor function::function(unsigned ser, const ex &
param1) which doesn't do anything intersting. (This also accounts for
the behavior described in <http://www.ginac.de/FAQ.html#evaluation>.)
Cheers
-richy.
--
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>
More information about the GiNaC-devel
mailing list