floor(log(1331)/log(11))



On 12/13/06, Fabrizio Caruso <caruso at dm.unipi.it> wrote:
> should floor(log(1331)/log(11)) output 3?

It is always possible to add more cases to the standard default
simplifier, and there is no clear criterion for which ones to include
and which ones not to include (though there are some general
guidelines we can discuss).  For example, Maxima simplifies sin(%pi/4)
=> 1/sqrt(2), but not sin(%pi/8) => sqrt(2-sqrt(2))/2 (by default).

Pertinently to your example, Maxima does not simplify log(121)/2 =>
log(11) or log(121)/log(11) => 2.  At least not by default.  You
*can*, however, ask Maxima to work harder at simplifying such
expressions using radcan, thus:

              radcan(  floor( log(1331)/log(11) ) ) => 3

This doesn't help, though, for "floor" when the inner expression is
not exact.  Maxima currently can't do anything useful
floor(log(1332)/log(11)) other than numerical evaluation, and as you
say, it is possible that that will give incorrect results.  Of course,
the 'floor' simplifier could be extended to recognize cases like
floor(log(a)/log(b)), where a and b are rational, and extract the
exact root, but that seems like an awfully special case, which
wouldn't handle other interesting (?) cases like, say,

           floor(2*(sqrt(10^100+10^50)-sqrt(10^100-1)))

The only *general* solution I know for avoiding incorrect results with
arbitrary expressions is a numerical evaluation using some sort of
interval arithmetic, and increasing precision until the interval is
unambiguous (if it ever becomes unambiguous).  That would be a good
idea, but we don't currently have the machinery to do it.

            -s