Base of natural logarithm
Hi, is there a way to create a ginac object "e" such that log(e) automatically evaluates to 1? I tried ex EulernumEvalf() { return numeric(cln::exp1()); } const constant Euler_number("Eulernum", EulernumEvalf, "e", domain::positive); Thanks! Jan
Hi, On 11/28/2015 01:38 PM, Jan Rheinländer wrote:
is there a way to create a ginac object "e" such that log(e) automatically evaluates to 1?
I tried
ex EulernumEvalf() { return numeric(cln::exp1()); } const constant Euler_number("Eulernum", EulernumEvalf, "e", domain::positive);
You can define this, but this does of course not make the eval function of log(x) know about your constant: it will look at its argument, shrug at this unknown constant, and decide that log(Euler_number) is as good as it gets. Such a constant was not included in GiNaC because of its redundancy with exp(1). Introducing it forces to make decisions whether to rewrite exp(1) -> e or e^x -> exp(x) and so on. The feeling was that it could jeopardize confluence of term rewriting. -richy. -- Richard B. Kreckel <http://in.terlu.de/~kreckel/>
participants (2)
-
Jan Rheinländer
-
Richard B. Kreckel