Message Boards Message Boards

0
|
4370 Views
|
5 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How to enter high precision numerical constants?

Posted 10 years ago

New to Mathematica (ver 9). Trying to use numerical constants with about 20 decimal places in functions like N, but it keeps converting them to 6 decimal places. I know this has to be an easy thing to do, but cannot find it anywhere in the docs.

POSTED BY: rhutson2
5 Replies
POSTED BY: David Reiss

Beware of the decimal point! It will kill your high precision.

If you enter

N[E^2,20]

you get 7.3890560989306502272.

But if you enter

N[E^2. ,20] 

You get only 7.38906.

If you need to use fractional amounts rationalize them fiirst

If you want a high precision estimate for 2^2.125. enter

N[2^Rationalize[2.125, 0], 20]

instead of

N[2^2.125, 20]

.The 0 in Rationalize[] makes sure the decimal is rationalized completely, not just substituted by an approximation.

POSTED BY: Marvin Ray Burns
Posted 10 years ago

Here's a simplified example:

N[2*1.23456789, 20]

returns:

2.46914

How do I get it to return more digits?

POSTED BY: rhutson2
POSTED BY: David Reiss
Posted 10 years ago

Thank you, this was exactly what I was looking for. I knew there had to be a simple solution.

POSTED BY: rhutson2
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