Message Boards Message Boards

0
|
4168 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

[?] Understand significant digits?

Posted 6 years ago

Consider the following code:

hz = N[28 2^(-(n/6)) , {Infinity, 3}];
        Column[Table[{n, hz}, {n, 36, 41}]]

Why do I get two different types of results digitwise?

POSTED BY: Nelson Zink
3 Replies
Posted 6 years ago

Thanks both.

POSTED BY: Nelson Zink

Because the numbers in 28 2^(-(n/6)) are approximated, resulting in 7.00 2.00^(2.00 - 0.17 n) for hz, the values of hz for the integers n in the Table are computed and the propagated rounding error represented by the Precision of the number is calculated and stored as the Precision of the result. If you put the N[...] inside Table, it will do what you expected.

POSTED BY: Michael Rogers

N makes a number with accuracy '3'. But the displaying of these numbers is a different thingÂ…

To control the displaying of numbers use e.g. NumberForm:

hz=28 2^(-(n/6));
Column[Table[{n,NumberForm[N@hz,{\[Infinity],3}]},{n,36,41}]]
POSTED BY: Sander Huisman
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