Returning more than 12 digits for a result
03-18-2018, 08:15 AM (This post was last modified: 03-19-2018 02:22 AM by brickviking.)
Post: #1
 brickviking Senior Member Posts: 336 Joined: Dec 2014
Returning more than 12 digits for a result
I thought I'd post this as a new thread instead of appending to my previous discussion, as that got a bit off what I was trying to do.

A while ago, I came across a discussion on these forums that allowed my HP-50G to give me far more than the customary 10 digits for an arbitrary equation, though I can't remember what the equation was, nor the RPL code backing it up. In this particular case, I'm after more than 12 digits of pi. However, I can't find that discussion anywhere, though pier4r has something somewhat related. I've also not been able to duplicate that feat since except by running PI50G.

I ran across this video about manually calculating pi yesterday, and I decided to run that formula through my calculator (the Chudnovsky algorithm). I started off nice and simply and set the sum (see formula) to k=2, a small number that should have resulted in about 21 correct digits. Unfortunately, I was disappointed when my calculator coughed up a result of 3.14159265359 for k=2, which while correct as far as it goes, was nowhere near the number of digits I'd intended for a result. Is there any way to cough up more digits from that formula without using a multiple-precision library, i.e. only using what's available with the stock hp-50G? I'd tried both Exact mode and Approx mode, but I'm not sure what else I actually need.

Here's the formula for those of you brave enough to enter it in:

'426880×SQRT(10005)/⅀(K=0,2,(6×K)!×(545140134×K+13591409)/((3×K)!×K!^3×(-262537412640768000)^K))'

The funny "⅀" symbol is SUM (RS-SIN) and the "×" is * (multiply) for those of you that don't have fully-working Unicode fonts.

BrickEdit: Changed SQ() to SQRT, as per a later post in this thread. Thanks, Gerson.

(Post 190)

Regards, BrickViking
HP-50g |Casio fx-9750G+ |Casio fx-9750GII (SH4a)
03-18-2018, 10:26 AM
Post: #2
 pier4r Senior Member Posts: 2,224 Joined: Nov 2014
RE: Returning more than 12 digits for a result
Nice video, although Matt made a "parker square" error again. (If someone follows standupmaths and numberphile on youtube, Matt "square" Parker is known for his "I give it a try even if I fail" that I love. We need more people like Matt and James Grime and others.... I would duplicate people also from this forum without a second thought)

Some notes (that may be confirmed or not by more knowledgeable people) follows.

The formula shown in the video is integer based (well, aside from the result) so you can create a program to compute the single parts. The 50g has built in exact mode for large numbers.

For the division, either you program by yourself or you find (and then share please) a division algorithm that works as Matt did in the video using only integers (it is a matter of repeated subtractions). Therefore outputting the result as a string rather than a floating point number. question to people with better memory: did someone created such algorithm already in RPL?

So either the above, or you use longfloat ( https://www.hpcalc.org/details/5363 ). One of the many libraries that are amazing for the 50g (sadly one of the few that I know. So much gold out of there that I am not aware of).

Or we add another processing list challenge and we treat lists as numbers and we implement addition / subtraction / division / etc.... That may be not fast, but would be fun and maybe expressive. (one could do the same with strings)
Hmm, adding to my endless todo list.

Others may have other ideas.
Said that, on PI (less on other irrational numbers) much was computed in this forum. I am going to pick some discussions that may help one sec...

Wikis are great, Contribute :)
03-18-2018, 10:35 AM
Post: #3
 pier4r Senior Member Posts: 2,224 Joined: Nov 2014
RE: Returning more than 12 digits for a result
there is a RPL program for at least 1000 digits.

[OT] 355/113 and pi

Ongoing Pi Programming Contest

there are others of course, but I did not see references to RPL / hpgcc when I skimmed the discussion.

Wikis are great, Contribute :)
03-18-2018, 11:53 PM (This post was last modified: 03-18-2018 11:56 PM by Gerson W. Barbosa.)
Post: #4
 Gerson W. Barbosa Senior Member Posts: 1,498 Joined: Dec 2013
RE: Returning more than 12 digits for a result
(03-18-2018 08:15 AM)brickviking Wrote:  I ran across this video about manually calculating pi yesterday, and I decided to run that formula through my calculator (the Chudnovsky algorithm). I

Here's the formula for those of you brave enough to enter it in:

'426880×SQ(10005)/⅀(K=0,2,(6×K)!×(545140134×K+13591409)/((3×K)!×K!^3×(-262537412640768000)^K))'

The funny "⅀" symbol is SUM (RS-SIN) and the "×" is * (multiply) for those of you that don't have fully-working Unicode fonts.

Interestingly the double of 13591409, one of the integer constants in the formula, equals to 27182818, as noticed by someone in a comment to the video. This leads to (5000000 - pi/60)*e = 13591408.99996632, a remarkable coincidence.

No bravery is required for just copying and pasting the formula. Anyway, here are the results for various k, for checking purposes:

0: pi - 5.90E-014
1: pi + 3.08E-028
2: pi - 1.72E-042
3: pi + 1.00E-056
4: pi - 5.96E-071
5: pi + 3.61E-085
6: pi - 2.21E-099
7: pi + 1.37E-113
8: pi - 8.51E-128
9: pi + 5.33E-142

426880×SQRT(10005)/SUM(K=0,2,(6×K)!×(545140134×K+13591409)/((3×K)!×K!^3×(-262537412640768000)^K))

SQ has been replaced with SQRT to avoid confusion with x^2.
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)