Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #16573

Re: Possible bug in Floor function?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx01.iad01.newshosting.com!newshosting.com!newspump.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail
From John Doty <noqsiaerospace@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Possible bug in Floor function?
Date Tue, 18 Feb 2014 03:46:57 +0000 (UTC)
Sender steve@smc.vnet.net
Approved Steven M. Christensen <steve@smc.vnet.net>, Moderator
Message-ID <ldul3h$lbd$1@smc.vnet.net> (permalink)
References <20140215090214.8888569D4@smc.vnet.net> <ldpdtt$6oe$1@smc.vnet.net>
Lines 157
Organization Time-Warner Telecom
NNTP-Posting-Date 18 Feb 2014 03:52:25 GMT
NNTP-Posting-Host f195e42a.news.twtelecom.net
X-Trace DXC=_ONh?hMaO<M;6T0N`<hDhFC_A=>8kQj6M;[h;PUXBgbD?SWP;HjUf@FEFiONJ7[GoF=DP[ADOl^JJ
X-Complaints-To abuse@twtelecom.net
X-Received-Bytes 3177
X-Received-Body-CRC 3837361338
Xref csiph.com comp.soft-sys.math.mathematica:16573

Show key headers only | View raw


The problematic function here is Log. While Log[x,y] with exact numeric arguments will transform to an exact numeric value if possible, in other cases it transforms to Log[y]/Log[x]. But then, nothing short of FullSimplify[] seems to be able to reverse this. So, Floor[] sees Log[100]/Log[10] and cannot reduce it to an exact numerical value. It falls back on interval arithmetic, but that can't work at a point where Floor[] is discontinuous.

Floor[] seems to have no trouble with other hairy expressions that happen to equal integers, for example "((-1)^(1/3) + (-1)^(2/3))/Sqrt[-3]". But a mere Simplify[] reduces that to 1. Perhaps that's where the real bug is. Does Floor[] try Simplify[]? Maybe Simplify[] should be transforming things like Log[100]/Log[10].

On Saturday, February 15, 2014 11:13:49 PM UTC-5, Bob Hanlon wrote:
> It is sometimes better to simplify expressions prior to using numerical
>
> techniques.
>
>
>
>
>
> $Version
>
>
>
>
>
> "9.0 for Mac OS X x86 (64-bit) (January 24, 2013)"
>
>
>
>
>
> Off[Floor::meprec] (* Supressing error messages. This does not change the
>
> results. *)
>
>
>
>
>
> Floor[Log[10, x]] /. x -> 100 //
>
>   FullSimplify // N
>
>
>
>
>
> 2.
>
>
>
>
>
> Floor[Log[10, x] /. x -> 100 //
>
>    FullSimplify] // N
>
>
>
>
>
> 2.
>
>
>
>
>
> Oddly, using PowerExpand results in an integer result despite the use of N
>
>
>
>
>
> Floor[Log[10, x]] /. x -> 100 //
>
>   PowerExpand // N
>
>
>
>
>
> 2
>
>
>
>
>
> Floor[Log[10, x] /. x -> 100 //
>
>    PowerExpand] // N
>
>
>
>
>
> 2
>
>
>
>
>
>
>
> Bob Hanlon
>
>
>
>
>
>
>
>
>
> On Sat, Feb 15, 2014 at 4:02 AM, psycho_dad  wrote:
>
>
>
> > Hi,
>
> >
>
> > I think I may have stumbled upon a possible bug in Floor. Evaluating the
>
> > following gives the correct result:
>
> >
>
> > Floor[Log[10, 100.]]
>
> > 2
>
> >
>
> > Evaluating it with a replacement and //N gives a message and the wrong
>
> > result:
>
> >
>
> > Floor[Log[10, x]] /. x -> 100 // N
>
> >
>
> > Floor::meprec: Internal precision limit $MaxExtraPrecision = 50.` reached
>
> > while evaluating Floor[Log[100]/Log[10]]. >>
>
> >
>
> > 1
>
> >
>
> > I'm on Math 9.0 + Win7, but Math 8 gives the same (wrong) result as well.
>
> >
>
> > Cheers
>
> >
>
> >

Back to comp.soft-sys.math.mathematica | Previous | NextPrevious in thread | Find similar


Thread

Re: Possible bug in Floor function? Bob Hanlon <hanlonr357@gmail.com> - 2014-02-16 04:13 +0000
  Re: Possible bug in Floor function? John Doty <noqsiaerospace@gmail.com> - 2014-02-18 03:46 +0000

csiph-web