Message Boards Message Boards

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

[?] Get 1,000,000 digits of e^(-Pi/2) without running out of memory?

Posted 6 years ago

N[E^(-[Pi]/2), 34650] runs out of memory. N[E^(-[Pi]/2), 34649] does not. The message I get is: The current computation was aborted because there was insufficient memory available to complete the computation.

Is there any way to get around this? I would like to get 1,000,000 digits for a project.

Thanks.

POSTED BY: Douglas Marsh
4 Replies

The first number is number of seconds it took the Kernel to return the results. I would suggest that you just run your command to the maximum amount of digits you need. Don't try to figure out if WL can return results for 500,000 or 725,000 just to all 1,000,000 save the result to file or use the function RealDigits.

RealDigits[N[E^(-Pi/2), 1000000]]

Returns a list whose first contents is a list of the digits and the last content is number is the exponent.

POSTED BY: Hans Michel
Posted 6 years ago

Thanks, as you might have figured out I'm a newb at this, what is the {8.86385, \ in you post. BTW escaping Pi seems to help, at least it's not immediately kicking out the memory error any more.

POSTED BY: Douglas Marsh

Just to add to George's answer

N[E^(-Pi/2), 1000000] // AbsoluteTiming
{8.86395, \
0.20787957635076190854695561983497877003387784163176960807513588305541\
9877285482139788600277865426035340521773307235021808190619730374663986\
9999112631786412057317177795200674337664954224638192973743...

Barely made a dent on memory usage. And was not a fresh Kernel.

POSTED BY: Hans Michel

You have a syntax error.

I used

N[E^(-Pi/2), 50000]

and there was no problem. I tried several other numbers, including 34650, and there was not problem with the correct code.

You may have wanted to enter the greek symbol for pi, using \[Pi]. If this is the case, you missed the '\'. On my system, the entry automatically changes to ? before evaluation.

I find it easier to use the escape key to enter ?, esc-p-esc, as documented on the page for Pi.

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