One more slice of PI



#2

From an earlier posting by Bill (Smithville, NJ):

"Another Slice of PI

Posted by Bill (Smithville, NJ) on 11 May 2004, 2:32 p.m.

For those who are curious....

I entered the PI program from PPC V7N5 Page 9 & 10 into the 42S. Just ran it for 500 digits in standard speed mode.

Took 1 hour and 20 minutes.

Now to do a 1,000 digits in both normal and Fast modes.

..."


Later in the thread there is reference to a revised version of Ron Knapp's program (PPC Journal V8N6P69 Aug-Dec 1981).

Questions:

1) Where can this revised version be found online?

2) How to set the fast speed mode on the HP 42S?

Thanks.


P.S.: It is possible to calculate 4020 decimal places of pi on the 42S, if SIZE is set to 811 and PI is the only program in memory. It would take about eight days to run, though. (This is a rough estimate based on the time it took to run with Emu42 - don't have the 42S anymore...).


#3

hi there,

out of interest, its actually possible to calculate pi to arbitrary length on the 42s. but there's a catch: it takes too long.

a while back, i wrote a program i called "deep pi" for the 41c that calculates the next 6 digits of pi from any given point in the decimal expansion. note: its possible to do this without having to precalculate all previous digits!

some of the guys on this forum converted the program to the 42s, but still it was way too slow. i was hoping, for example, to get about 1000 digits in only about twice the time of previous programs, buts its longer than that.

maybe when i get time, i will try again to improve it. but i cant see it suddently being *that* much faster. plan b: wait for some more pi theory to be disovered!

anyway, there's a copy of my program on my 41cv page.

regards,

http://www.voidware.com/calcs/hp41cv.htm


#4

Hugh:

I don't think I've ever heard of a program that lets you find 6-digits of pi starting anywhere without finding earlier digits. Would you have a reference for the algorithm? I did look at your Web site, but don't really want to try to deconstruct your HP-41 code.

Thanks.
Larry


#5

Larry posted:

"I don't think I've ever heard of a program that lets you find 6-digits of pi starting anywhere without finding earlier digits."

Have a look at this

The caveat is, it only works for hexadecimal digits of Pi.
No such formulae are known or believed to exist for base-10 digits, though they actually exist for some transcendental constants, such as log(9/10), where the corresponding formula has been used recently to compute its ten billionth decimal digit (US 'billions', i.e., 10^9).

This also applies to other bases and constants, such as base 2, for which you can compute individual digits of
log(n), for n=2,3,5,7,11,13,17,19,29,31,37,41,43,61,73,...
...,18837001, 22366891, ...

Alas, no such luck for base-10 and Pi.

Best regards from V.


#6

yes, indeed. thanks valentin. this is the information i used to try to write it on the 41.

i used the methods described in this paper for the decimal version. http://numbers.computation.free.fr/Constants/Algorithms/nthdecimaldigit.pdf

what i did is take their code and hack it down as much as possible for calculators. here is my final "C" version before i translated it for the 41. if you know C, this is much easier to understand than the 41c code. you're quite welcome to try to improve it. i dont take any credit for the method.

http://www.voidware.com/tmp/pi3.c

best wishes,


#7

Greetings Hugh!

I've been running your Deep Pi program simultaneously on 2 HP 41CVs as an exercise in "verifying" the digits of pi. I have one calculator generate 6 digits and the other calculator generate the next 6 digits, then the first calculator generate the following 6 digits, on and on. Currently working on digits 349 thru 354 and 355 thru 360. It's now taking about 3 days +/- per set of 6 digits. Couldn't do it without the AC adapters and rechargeable battery packs.

Comment: On 2 separate trials, when I've asked for digits 73 thru 78, my calculator has returned "286209". The 78th digit should be an "8" rather than a "9". The 79th, 80th and 81st digits of pi are "9", "9", and "8", respectively.
So, just wondering if you were aware of this apparent roundoff error. There is a comment in your code about rounding error accumulation.

Very best regards,
Mark Taylor


#8

Have a look at the following poem:

http://users.aol.com/s6sj7gt/mikerav.htm


#9

Klaus:

Thanks for referring me to these clever pi mnemonics. Very entertaining!
Mark Taylor

#10

hi mark,

this is very depressing. you are right about the 73rd digit. the main part of the pi program performs the summation and the code right at the start of the program is the bit that does the 1e6 * INT for display. i commented this out to see the floating sum at 73. the 41 gets 0.286209003. as you can see, cumulative errors in the summation have caused it turn over a 9 whilst it should be 8 then 998628 as you correctly point out.

i was hoping to get away with 6 at a time. unfortunately, although the theory behind the algorithm gives you the number of summation terms, there is no way i'm aware of to know how to compensate cumulative summation errors. consequently, i have down graded the correct payload to only 5 digits. this, of course, makes the method even worse and would almost take for ever to get even 1000 digits this way on a real 41.

one possibility for improvement would be to perform less terms of the summation. the idea being that, although the theory gives the sum length, but if only half (say) of the resultant digits are trusted, maybe a lot less summing can be done.

indeed, the method derives from one designed to give binary answers. in fact, for binary, the method is algorithmically quicker than the best known decimal pi method. although a version of pi in binary isn’t very useful and this method was derived to give a decimal expansion. the people behind it know that it’s a bit hacky. maybe in due course there will be a better way to collect the decimal expansion from the binary method. that would be good.

originally, i was motivated to write this program with the idea that one could leave a 41 (or 42s) and a printer going whilst it went on and on printing out pi. the concept of having no state between output batches is very attractive for a low memory calculator program.

thanks for pointing this out and if you think of any good ideas, please pass them on.

PS. i put the "pi.raw" binary here http://www.voidware.com/calcs/pi.raw i test it by loading it into v41 and jamming TAB down...


#11

Hi again Hugh,

Thanks for your response. I don't understand much about the algorithms and programming but I've enjoyed making my HP-41's really work in generating the digits of pi. Also, keying in the 511 program steps of Deep Pi without making a mistake is a challenge!


Undoubtedly, there must be other groups of 6 digits in which the last digit may show a roundoff error. The 78th digit(by 6s) is the only one I've encountered so far.

My two 41's are still going, currently working on digits 355-360 and 361-366.

Will you be posting a new Deep Pi program on voidware.com in which just 5 digits at a time are generated?

Thanks again,
Mark Taylor,
Civil Engineer and Land Surveyor, California, USA


#12

Hugh:

Sorry, I should have checked voidware.com first. I see that there is already a new Deep Pi program there.

Something else for me to try!

Regards,
Mark Taylor

#13

Valentin:

Thanks for the reference. Don't know if I'll do any calculator programming with this, but I may play around with it in Java.

Larry


Possibly Related Threads...
Thread Author Replies Views Last Post
  [OT] Mathematica free for Raspberry PI BruceH 32 2,288 11-23-2013, 05:24 AM
Last Post: Nick_S
  Computing pi with the PC-1300S Kiyoshi Akima 0 235 11-17-2013, 12:24 AM
Last Post: Kiyoshi Akima
  Calculating Pi LHH 9 714 09-27-2013, 10:50 PM
Last Post: Gerson W. Barbosa
  Visualization of pi Bruce Bergman 13 957 08-17-2013, 05:00 PM
Last Post: Howard Owen
  OT: Happy Pi Day! Eddie W. Shore 13 987 03-22-2013, 10:44 AM
Last Post: Les Koller
  Totally OT ... Pi Day for my car Maximilian Hohmann 18 1,212 03-10-2013, 01:15 PM
Last Post: chris smith
  [WP34S] A funny bug in Pi (prod) Eduardo Duenez 3 444 01-28-2013, 03:41 AM
Last Post: Walter B
  28S Pi Functionality Matt Fegenbush 3 401 10-17-2012, 02:15 AM
Last Post: Nick_S
  e^pi - pi + 9/10^4 + 1/(10^4*ln(2) + sqrt(10)/6)^2 Gerson W. Barbosa 47 3,200 08-08-2012, 10:58 PM
Last Post: Les Koller
  [OT] 355/113 and pi David Hayden 28 1,633 07-27-2012, 10:01 AM
Last Post: Egan Ford

Forum Jump: