On Thu, Mar 13, 2008 at 6:12 PM, Richard Fateman
<fateman at cs.berkeley.edu> wrote:
> %pi^x+%e^x, numer --> %e^x+3.1415...^x;
> can anyone explain why this should be?
Richard,
This behavior has been in there since the olden days, and is
intentional (but arguably misguided). Summary: if you want uniform
behavior, set %enumer:true, and you're all set. If you want to do
better than that....
The intent is that symbolic expressions should only become numbers
when that allows further simplification through numerical operations,
and not when it just obscures the structure of the expression. So, not
only does %e^x not become 2.718^x, but also x+2 does not become x+2.0,
x^2 does not become x^2.0, and 2^x does not become 2.0^x. On the other
hand, %e^2 does become 7.39, and (2/3)^x => 2^x/3^x,numer => 0.667^x.
On the other hand, a bare %pi simplifies to 3.14, and %e^(%i*%pi*x)
simplifies to %e^(3.14*%i*x), which is useless. This is because %pi
(under numer) always simplifies to 3.14, presumably on the theory that
cases like sin(x+%pi/2) are already simplified symbolically.
A bare %e (under numer) should arguably simplify to 2.72, but it is
not clear where to put that logic in the code. There's no way in the
simplifier to know that the %e is "bare", unlike %e^2, where simpexpt
has all the information it needs. The case where 2^%e and %e^%e,numer
do not become numeric are bugs, and should be fixed (I think I
reported this bug a long time ago) -- simpexpt has access to all the
necessary information.
You certainly don't want every simplifier which could simplify a
float, but not a symbolic %e, to have to check explicitly, cf.
gamma(%e),numer which does *not* give a numerical result.
Note that ev(%e,numer) is special-cased in ev.
It is trivial to have %e => 2.72 everywhere whenever numer is true,
but then %e^x+%e^-x, numer would become 2.72^x+2.72^-x, which isn't
very pretty.
But all you have to do is set %enumer:true.
-s