Message Boards Message Boards

0
|
2957 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

Mistakes: Where is Mathematica's or my mistake

Posted 10 years ago

Hello,

entering the following commands

N[Log[10^3]/Log[10], 20] N[Log[10^3]/Log[10] + 1., 20] Floor[%]

in mathematica 8 I get the following output:

3.0000 4. 3

I think, of course, the last output should be 4 and not 3. Otherwise one would have Floor[4.]=3 and this is nonsense.

In consequence there is an additional similiar problem. Entering Floor@(Log[10, 10^Range[10]] + 1) Floor@(Log[10^Range[10]]/Log[10] + 1.)

one gets as output {2, 3, 4, 5, 6, 7, 8, 9, 10, 11} {2, 3, 3, 5, 5, 6, 7, 9, 9, 10}

My students and me were very astonished and could not understand mathematica outputting such obvious nonsense (the last output agaim). Of course, both outputlines should be identical.

Could someone in the community give me an advice? Thanks in advance!

Peter Quedens

POSTED BY: Peter Quedens
Posted 10 years ago

This is a good opportunity to teach your students about how numbers (real and integer) are stored in a computer and displayed on the screen. The function RealDigits will be helpful:

RealDigits[Log[10^3]/Log[10] + 1.]
RealDigits[N[Log[10^3]/Log[10] + 1., 20]]
POSTED BY: Jim Baldwin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract