You know, just as I was driving to work this morning, I thought, damn, I should have grabbed my 82240 on the way out and printed a few hundred digits of pi with my 48SX!
Guess I'll go dig through the software library and see what I can do with my DM41L.
Happy Pi Day 2017! Cool program, Gerson!
Next year should everything work out, I'll be celebrating my 41st birthday (I'm 40 today) with an HP 41C.
(03-14-2017 01:06 PM)Eddie W. Shore Wrote: [ -> ]Happy Pi Day 2017! Cool program, Gerson!
Next year should everything work out, I'll be celebrating my 41st birthday (I'm 40 today) with an HP 41C.
Eddie, I wish you a nice and cheerful day and may all your goals come true!
(03-14-2017 01:24 PM)Eddie W. Shore Wrote: [ -> ]Thank you Gerson!
You are most welcome, Eddie!
(03-14-2017 01:06 PM)Eddie W. Shore Wrote: [ -> ]Next year should everything work out, I'll be celebrating my 41st birthday (I'm 40 today) with an HP 41C.
Happy birthday, as well! Since last year's
Pi Approximation Day I'm Fib(10) years old. I wish all of us here to celebrate many and many Pi Days and Fib(11) birthdays one day :-)
Gerson.
Edited to add a forgotten verb between a pronoun and an adverb and to remove a definite article. I don't want to sound – or read – "awkward" :-)
Thank you all for the Pi-related links and comments!
The first program in the directory, PId, computes
d digits of
π using the simple formula
\[\pi=4\cdot \arctan (1)\]
Arctan(1) is calculated using the formula previously presented
here,
\[\frac{\pi }{4}= 1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\cdots +\frac{1}{2n-3}-\frac{1}{2n-1}+\frac{1}{4n+\frac{1^{2}}{n+\frac{2^{2}}{4n+\frac{3^{2}}{n+\frac{4^{2}}{4n+... }}}}}\]
using
n equal number of terms of the regular series and of the continued fraction. The second program (PIn) computes the sum of such n terms. Its slowness for large number of digits or terms is due to the limitation of the HP-49G/50g when dealing with the resulting very long algebraic expression before it is eventually expanded. Freeing more memory might help.
The third program, PIdLF, is a
LongFloat Library version of PId.
PiM and PiMlf, its equivalent LongFloat version, compute
π using
Machin's formula:
\[\pi = 16\cdot \arctan \frac{1}{5}-4\cdot \arctan \frac{1}{239}\]
That's the same formula used by
William Shanks to compute
π about 150 years ago, after spending 15 years in the task, done by hand, without using any computing devices whatsoever. The last 180 digits being wrong is not impressive, the first 527 digits being correct is. That's why we have used two different methods. As we can see, but for for a rounding in the last digits in the fourth printing, all digits match.
Gerson.
355/113 is enough for me B-)
(03-15-2017 11:04 AM)franz.b Wrote: [ -> ]355/113 is enough for me B-)
That's perhaps the most efficient rational approximation for \(\pi\): six digits in a mnemonic sequence giving seven correct digits.
The 1762-digit fraction below gives only 707 digits (perhaps a few more) and is somewhat hard to memorize.
------------------------------
707
« PUSH RAD -105 CF -3 CF DUP .653 * 1.74 + IP R→I DUP 2 MOD + DUP 4 * OVER DUPDUP 1 - 1
FOR i i SQ SWAP / PICK3 + ROT SWAP -1
STEP INV NIP UNROT + 1 - 3 0 UNROT
FOR i i INV i 2 - INV - + -4
STEP - 4 * EXPAND →STR "'" "" SREPL ROT DROP2 POP
»
:s: 1274.5305 (time on my iPhone)
35471270118869764571868355345605539644932682747073948595148728173396218838668496807164261249025584732733447180406782632233100073005480984469449407355631751951857932330423810870967190441865169301769333638373110660302700491482945444585732820105924605428311002761716473437615659392155761487611060526868601273453231898921986033467508953705826437947232221130307331236975137794949585690105209169659222613615091278193473671810180461713896937461266702114523287846642413110136614196936176976029123163627319062908158192243507523352526680253139185385238035253759673955361647533057729961933967438732663683013268610818106513210628256422354671300838866942997862434460365675067121733569309784654487598949230595519145549666784079635895854318597270213456322812296404622832012961138994524991861828477269161456938399075366416135189699798372878186147147377096190114953814771793002615563275568590880768
/
11290855954331929765162875991672337005763900233129789215007366526465816927928074999105190513907196301005180549814955324020004797097472202900194595496982909715308051980859823447314558965940861230833849596778794528130041951422123875810401220791617778874064429696755480283483475358841356899944430809069589392140510992481520008261154692775393292206410577076528088955347442330067218483215780693490726115076597692812403142588112902307500691056928074672318791539536323246345602121039586067513765201530999299014996124193701700437357615236050277051928851200804664427103092300733741860504772987941557705580993501918235022067678871782125063477497845164217020591975595102229045657335420399329352696468216747850425590255677095239755710260367678979941803636081060659736127271086039016609855284050676165107007788796808472179411442756875549846412143888154086151886389002255015784099310913692491875
------------------------------
Edited to add a missing 's'.
Edited again per Valentin's observation below.
.
Hi,
Gerson:
(03-15-2017 03:57 PM)Gerson W. Barbosa Wrote: [ -> ] (03-15-2017 11:04 AM)franz.b Wrote: [ -> ]355/113 is enough for me B-)
That's perhaps the most efficient rational approximation for \(\pi\): six digits in a mnemonic sequence giving six correct decimal places.
More like
seven correct decimal places, not six:
3,1415929.. vs.
3,1415926...
In my so-so humble opinion, the very best \(\pi\) approximation (i.e.: the
more correct digits using the
less digits and operations) is by far:
Ln(640320^3)/Sqrt(163) = 3,141592653589793016...
which gives
16 correct digits.
Regards.
V.
.
(03-15-2017 08:56 PM)Valentin Albillo Wrote: [ -> ] (03-15-2017 03:57 PM)Gerson W. Barbosa Wrote: [ -> ]That's perhaps the most efficient rational approximation for \(\pi\): six digits in a mnemonic sequence giving six correct decimal places.
More like seven correct decimal places, not six: 3,1415929.. vs. 3,1415926...
Hello, Valentin,
By decimal places I meant the ones at the right of the decimal point, but I have edited the post to avoid the ambiguity. Thanks!
Gerson.
(03-14-2017 05:07 PM)Gerson W. Barbosa Wrote: [ -> ]PiM and PiMlf, its equivalent LongFloat version, compute π using Machin's formula:
\[\pi = 16\cdot \arctan \frac{1}{5}+4\cdot \arctan \frac{1}{239}\]
I think that "+" should be a "-".
(03-15-2017 08:56 PM)Valentin Albillo Wrote: [ -> ]In my so-so humble opinion, the very best \(\pi\) approximation (i.e.: the more correct digits using the less digits and operations) is by far:
Ln(640320^3)/Sqrt(163) = 3,141592653589793016...
which gives 16 correct digits.
Spectacular! Are you also aware of this 18 digit approximation?
12/sqrt(190) * ln((2 sqrt 2 + sqrt 10)*(3+sqrt 10))
via
https://www.johndcook.com/blog/2012/10/0...oximation/
(03-17-2017 10:00 PM)EdS2 Wrote: [ -> ]12/sqrt(190) * ln((2 sqrt 2 + sqrt 10)*(3+sqrt 10))
Or, equivalently, using eight digits:
' √(18/95)*(LN(2)+2*(ASINH(2)+ASINH(3)))' (45 bytes)
« 2 ASINH 3 ASINH + 2 * 2 LN + 18 95 / √ * » (55.5 bytes)
It doesn't compare to the previous one, though:
'3*LN(640320)/√163' (33 bytes)
« 3 640320 LN * 163 √ / » (38 bytes)
This attempt needs twice more bytes for about the same accuracy:
'1/163*(69-EXP(-8/(1/163/401+1)))+e' (70 bytes)
« 163 INV DUP 401 / 1 + -8 SWAP / EXP 69 SWAP - * e + » (65.5 bytes)
(03-15-2017 03:57 PM)Gerson W. Barbosa Wrote: [ -> ] (03-15-2017 11:04 AM)franz.b Wrote: [ -> ]355/113 is enough for me B-)
That's perhaps the most efficient rational approximation for \(\pi\): six digits in a mnemonic sequence giving seven correct digits.
Here's an even better one:
\(\frac{1901870728566923076090143944714770339621590768313546337192526115562704339680963564320007808107929370299752345187688835741387003036853361285671158059867702399073227994426905220194699766118756059055619036488502928002591}{605384255146420326102361023215940531716391478150345020739231253172134740688232476946000058713774549796561447468267746412874022717544100946587144148739626803435133473281606663121381125761746030151344353855924025288111}\)
That's 433 digits (217 digits over 216 digits) that returns 435 digits of pi. Converting the above into a mnemonic is left as an exercise for the student.