Group Abstract Group Abstract

Message Boards Message Boards

0
|
5.8K Views
|
5 Replies
|
2 Total Likes
View groups...
Share
Share this post:

error in N // Floor? (corrected version)

Posted 11 years ago
POSTED BY: Peter Quedens
5 Replies
POSTED BY: Ilian Gachevski

From my understanding a CAS-system shouldn give here the same outputs.

And it does so. This problem arises solely from the mindless usage of N[]

In[27]:= Union[(Floor[N[FullSimplify[Log[10^3]/Log[10]], #]] - Floor[N[Log[10^3]/Log[10], #]]) & /@ RandomReal[{1., 100.}, 1000]]
Out[27]= {0}

if you consider that a sloppy argument, look at this

In[28]:= Floor[N[FullSimplify[Log[10^3]/Log[10]], 1.]] - Floor[N[Log[10^3]/Log[10], 1.]]
Out[28]= 0

even that works

In[31]:= Floor[N[FullSimplify[Log[10^3]/Log[10]], .0]] - Floor[N[Log[10^3]/Log[10], .0]]
Out[31]= 0

and this

In[32]:= Floor[N[FullSimplify[Log[10^3]/Log[10]], 0]] - Floor[N[Log[10^3]/Log[10], 0]]
Out[32]= 0

and this

 In[35]:= Floor[N[FullSimplify[Log[10^3]/Log[10]], $MachinePrecision]] - Floor[N[Log[10^3]/Log[10], $MachinePrecision]]
 Out[35]= 0

You hit seemingly the only case not working

In[34]:= Floor[N[FullSimplify[Log[10^3]/Log[10]]]] - Floor[N[Log[10^3]/Log[10]]]
Out[34]= 1

despite the description in the help, that In[35] is equivalent to In[34].

POSTED BY: Udo Krause

Hi,

Shouldn't Mathematica produce the same output for the following two inputs?

It should not, since you use N[] this kind of behavior (round off error) is normal.

I.M.

POSTED BY: Ivan Morozov
Posted 11 years ago

Hi,

yes, N is used, but it is used in both expressions and so it should give the same result, since the only difference ist the FullSimplify. In any case: I think mathematica should know, that Log[10^3]/Log[10] is 3 without a FullSimplify. P.Q.

POSTED BY: Peter Quedens

Even it is used in both expressions it is applied to different ones:

Log[10^3]/Log[10] // FullSimplify // N // Floor // Trace
Log[10^3]/Log[10] // N // Floor // Trace

I.M.

POSTED BY: Ivan Morozov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard