Happy Pi day everyone!!
|
03-16-2019, 06:14 PM
Post: #21
|
|||
|
|||
RE: Happy Pi day everyone!!
(03-15-2019 12:45 AM)Valentin Albillo Wrote: … trivially easy to convert to RPN, RPL or whatever: Here's a program for the HP-42S: Code: 00 { 36-Byte Prgm } Quote:FNP(1000000) -> 3.14159 Example: 1E6 XEQ "A002491" 318,310,503,562 1E12 X<>Y ÷ 3.14158656032 Cheers Thomas |
|||
03-16-2019, 10:43 PM
Post: #22
|
|||
|
|||
RE: Happy Pi day everyone!!
(03-16-2019 05:11 PM)Thomas Klemm Wrote: Excellent ! It's a "The Far Side" one, isn't it ? I was presented with an original "The Far Side" 1992 Calendar back then and every day of the year had one such (366 in all) and I loved it, the humour and art were truly amazing ! Have a nice weekend. V. . All My Articles & other Materials here: Valentin Albillo's HP Collection |
|||
03-17-2019, 12:38 AM
(This post was last modified: 03-17-2019 12:39 AM by Thomas Okken.)
Post: #23
|
|||
|
|||
RE: Happy Pi day everyone!!
(03-16-2019 06:27 AM)Carsen Wrote:(03-15-2019 05:07 AM)Valentin Albillo Wrote: To reciprocate, I'd recommend the song "PI" (Greek character, actually) from Kate Bush's 2005 double album "Aerial", in which she sings up to the 78th decimal place of Pi, and after that from the 101st to the 137 th. If you like that, she took the whole laid back and atmospheric thing to another level on "50 Words For Snow." The title alludes to the many words for snow the Inuit languages are supposed to have, but it's actually a lot more poetic than that. ![]() |
|||
03-17-2019, 12:56 AM
Post: #24
|
|||
|
|||
RE: Happy Pi day everyone!!
For songs, there's always, "By By Miss American Pi."
|
|||
03-17-2019, 01:48 AM
(This post was last modified: 03-22-2019 04:39 PM by Gerson W. Barbosa.)
Post: #25
|
|||
|
|||
RE: Happy Pi day everyone!!
(03-14-2019 08:58 PM)Gerson W. Barbosa Wrote: Optimization and conversion to HP calculators are left as an exercise for the reader. The following is a very readable RPL version of the wp34s program in post #6: « '3/2*√3' '2*√3' → n a b « 1 n START '√(a*b)' →NUM 'a' STO '2*a*b/(a+b)' →NUM 'b' STO NEXT '√(a*b)' →NUM 'a' 1 'n' STO+ STO '((2+2^((1/a-72*n-1)/36))*a+b)/(3+2^((1/a-72*n-1)/36))' EVAL » » The original algorithm (in modern terms) by Archimedes of Syracuse is followed by a simple empirical adjustment formula in function of a and b, his lower and upper bounds, respectively. Starting with inscribed and circumscribed hexagons to a circle of diameter 1, after four more iterations we obtain a = 3.14103195089 and b = 3.14271459965, which Archimedes rationalized to 223/71 and 22/7. ' (27*(a^2*b)^(1/3) - 4*(2*a + b))/15' is a better formula. Furthermore, it allows for a shorter wp34s program: 0001 **LBL A 0002 # 003 0003 [sqrt] 0004 RCL+ X 0005 # 1/2 0006 INC X 0007 RCL[times] L 0008 RCL[times] Y 0009 [sqrt] 0010 || 0011 STO+ X 0012 RCL L 0013 DSE Z 0014 BACK 006 0015 RCL[times] Y 0016 [sqrt] 0017 [cmplx]ENTER 0018 x[^2] 0019 [times] 0020 [^3][sqrt] 0021 # 027 0022 [times] 0023 [<->] YZXT 0024 STO+ X 0025 + 0026 # 004 0027 [times] 0028 - 0029 # 015 0030 / 0031 END 4 A -> 3.141592653583662847516781540551053 10 A -> 3.141592653589793238462554257894971 16 A -> 3.141592653589793238462643383279503 (03-17-2019, 01:48 PM) PS: In order to keep both a and b on the stack, let’s change lines 0023 through 0027 to 0023 RCL Y 0024 RCL+ X 0025 RCL+ T 0026 RCL+ X 0027 RCL+ X 4 A -> 3.14159265358 ; (27*(a^2*b)^(1/3) - 4*(2*a + b))/15 Rv -> 3.14103195089 ; a Rv -> 3.14271459965 ; b (03-19-2019, 06:42 PM) PPS: 1 iteration should return the values for the hexagon, not the dodecagon. Fixed. -------- WP 34S: 0001 **LBL A 0002 # 004 0003 # 027 0004 [sqrt] 0005 RCL/ Y 0006 y[<->] L 0007 RCL[times] Y 0008 [sqrt] 0009 || 0010 STO+ X 0011 RCL L 0012 DSE Z 0013 BACK 006 0014 RCL[times] Y 0015 [sqrt] 0016 [cmplx]ENTER 0017 x[^2] 0018 [times] 0019 [^3][sqrt] 0020 # 027 0021 [times] 0022 RCL Y 0023 STO+ X 0024 RCL+ T 0025 STO+ X 0026 STO+ X 0027 - 0028 # 015 0029 / 0030 END 1 A -> 3.141460911773498978633977995517088 ; (27*(a^2*b)^(1/3) - 4*(2*a + b))/15 Rv -> 2.999999999999999999999999999999999 ; a, perimeter of the inscribed hexagon ( 3 ) Rv -> 3.464101615137754587054892683011744 ; b, perimeter of the circumscribed hexagon ( √12 ) 5 A -> 3.141592653583662847516781540551053 ; (27*(a^2*b)^(1/3) - 4*(2*a + b))/15 Rv -> 3.141031950890509638111352926459658 ; a, perimeter of the inscribed 96-gon Rv -> 3.142714599645368298168859093772122 ; b, perimeter of the circumscribed 96-gon 17 A -> 3.141592653589793238462643383279503 ; (27*(a^2*b)^(1/3) - 4*(2*a + b))/15 Rv -> 3.141592653556370963662823316554114 ; a, perimeter of the inscribed 196608-gon Rv -> 3.141592653656637788064203581586042 ; b, perimeter of the circumscribed 196608-gon -------- HP-42S/Free42: 00 { 72-Byte Prgm } 01▸LBL "PI" 02 27 03 SQRT 04 1.6875 05 SQRT 06▸LBL 00 07 RCL× ST Y 08 SQRT 09 RCL× ST Y 10 X<>Y 11 LASTX 12 + 13 LASTX 14 R↓ 15 ÷ 16 STO+ ST X 17 R↑ 18 DSE ST Z 19 GTO 00 20 RCL× ST Y 21 SQRT 22 STO ST Z 23 X↑2 24 RCL× ST Y 25 3 26 1/X 27 Y↑X 28 27 29 × 30 R↑ 31 STO+ ST X 32 RCL+ ST Z 33 STO+ ST X 34 STO+ ST X 35 - 36 15 37 ÷ 38 .END. 1 XEQ PI -> X: 3.141460911773498978633977995517088 R↓ -> Y: 3 -> X: 3.464101615137754587054892683011746 17 XEQ PI -> X: 3.141592653589793238462643383279505 R↓ -> Y: 3.141592653556370963662823316554116 -> X: 3.141592653656637788064203581586044 -------- HP 50g: 5 « '3/4*√3' '3*√3' → n a b « 1 n START '√(a*b)' →NUM 'a' STO '2*a*b/(a+b)' →NUM 'b' STO NEXT '√(a*b)' →NUM 'a' STO a b '(27*(a^2*b)^(1/3)-4*(2*a+b))/15' EVAL » » EVAL -> 3: 3.14103195089 2: 3.14271459965 1: 3.14159265358 -------- Finally, a stack-only wp34s version that preserves the original X-register content: 0001 **LBL A 0002 # 004 0003 # 027 0004 [sqrt] 0005 RCL/ Y 0006 y[<->] L 0007 RCL[times] Y 0008 [sqrt] 0009 || 0010 STO+ X 0011 RCL L 0012 DSE Z 0013 BACK 006 0014 RCL[times] Y 0015 [sqrt] 0016 STO Z 0017 x[^2] 0018 RCL[times] Y 0019 [^3][sqrt] 0020 STO L 0021 CLx 0022 # 027 0023 STO[times] L 0024 x[<->] Z 0025 z[<->] L 0026 STO L 0027 STO+ L 0028 x[<->] Y 0029 STO+ L 0030 x[<->] L 0031 STO+ X 0032 STO+ X 0033 STO- Z 0034 CLx 0035 # 015 0036 STO/ Z 0037 x[<->] L 0038 x[<->] Z 0039 END 314 ENTER 5 A -> 3.141592653583662847516781540551053 Rv -> 3.141031950890509638111352926459658 Rv -> 3.142714599645368298168859093772122 Rv -> 314 -------- (03-20-2019, 02:17 PM) PPPS: It ain't over till it's over (which doesn't mean further optimizations are not possible). -------- WP 34S: 0001 **LBL A 0002 # 027 0003 [sqrt] 0004 # 1/2 0005 RCL[times] Y 0006 || 0007 STO+ X 0008 RCL L 0009 RCL[times] Y 0010 [sqrt] 0011 DSE Z 0012 BACK 006 0013 [cmplx]ENTER 0014 x[^2] 0015 [times] 0016 [^3][sqrt] 0017 # 027 0018 [times] 0019 RCL Y 0020 STO+ X 0021 RCL+ T 0022 STO+ X 0023 STO+ X 0024 - 0025 # 015 0026 / 0027 END 1 A -> 3.141460911773498978633977995517088 ; (27*(a^2*b)^(1/3) - 4*(2*a + b))/15 Rv -> 2.999999999999999999999999999999999 ; a, perimeter of the inscribed hexagon ( 3 ) Rv -> 3.464101615137754587054892683011744 ; b, perimeter of the circumscribed hexagon ( √12 ) 5 A -> 3.141592653583662847516781540551053 ; (27*(a^2*b)^(1/3) - 4*(2*a + b))/15 Rv -> 3.141031950890509638111352926459658 ; a, perimeter of the inscribed 96-gon Rv -> 3.142714599645368298168859093772122 ; b, perimeter of the circumscribed 96-gon 17 A -> 3.141592653589793238462643383279503 ; (27*(a^2*b)^(1/3) - 4*(2*a + b))/15 Rv -> 3.141592653556370963662823316554114 ; a, perimeter of the inscribed 196608-gon Rv -> 3.141592653656637788064203581586042 ; b, perimeter of the circumscribed 196608-gon -------- HP-42S/Free42: 00 { 68-Byte Prgm } 01▸LBL "PI" 02 27 03 SQRT 04 6.75 05 SQRT 06▸LBL 00 07 R↓ 08 RCL× ST T 09 STO+ ST X 10 R↑ 11 RCL+ ST L 12 STO÷ ST Y 13 X<> ST L 14 RCL× ST Y 15 SQRT 16 DSE ST Z 17 GTO 00 18 STO ST Z 19 X↑2 20 RCL× ST Y 21 3 22 1/X 23 Y↑X 24 27 25 × 26 R↑ 27 STO+ ST X 28 RCL+ ST Z 29 STO+ ST X 30 STO+ ST X 31 - 32 15 33 ÷ 34 .END. 1 XEQ PI -> X: 3.141460911773498978633977995517088 R↓ -> Y: 3 -> X: 3.464101615137754587054892683011745 17 XEQ PI -> X: 3.141592653589793238462643383279505 R↓ -> Y: 3.141592653556370963662823316554116 -> X: 3.141592653656637788064203581586044 -------- HP 50g: 5 « '3/2*√3' '3*√3' → n a b « 1 n START '2*a*b/(a+b)' →NUM 'b' STO '√(a*b)' →NUM 'a' STO NEXT a b '(27*(a^2*b)^(1/3)-4*(2*a+b))/15' EVAL » » EVAL -> 3: 3.14103195089 2: 3.14271459965 1: 3.14159265358 -------- Finally, a stack-only wp34s version that preserves the original X-register content: 0001 **LBL A 0002 # 027 0003 [sqrt] 0004 # 1/2 0005 RCL[times] Y 0006 || 0007 STO+ X 0008 RCL L 0009 RCL[times] Y 0010 [sqrt] 0011 DSE Z 0012 BACK 006 0013 STO Z 0014 x[^2] 0015 RCL[times] Y 0016 [^3][sqrt] 0017 STO L 0018 CLx 0019 # 027 0020 STO[times] L 0021 x[<->] Z 0022 z[<->] L 0023 STO L 0024 STO+ L 0025 x[<->] Y 0026 STO+ L 0027 x[<->] L 0028 STO+ X 0029 STO+ X 0030 STO- Z 0031 CLx 0032 # 015 0033 STO/ Z 0034 x[<->] L 0035 x[<->] Z 0036 END 314 ENTER 5 A -> 3.141592653583662847516781540551053 Rv -> 3.141031950890509638111352926459658 Rv -> 3.142714599645368298168859093772122 Rv -> 314 -------- (03-22-2019, 04:39 PM) PPPPS: At least one more step can be saved in the second wp34S program: -------- 0001 **LBL A 0002 # 027 0003 [sqrt] 0004 # 1/2 0005 RCL[times] Y 0006 || 0007 STO+ X 0008 RCL L 0009 RCL[times] Y 0010 [sqrt] 0011 DSE Z 0012 BACK 006 0013 STO Z 0014 x[<->] L 0015 RCL[times] Y 0016 [^3][sqrt] 0017 STO L 0018 CLx 0019 # 027 0020 STO[times] L 0021 [<->] ZYZT 0022 STO+ Z 0023 [<->] YZXT 0024 STO+ Y 0025 x[<->] L 0026 [<->] YZXT 0027 STO+ X 0028 STO+ X 0029 STO- Z 0030 CLx 0031 # 015 0032 STO/ Z 0033 x[<->] L 0034 x[<->] Z 0035 END 314 ENTER 5 A -> 3.141592653583662847516781540551053 Rv -> 3.141031950890509638111352926459658 Rv -> 3.142714599645368298168859093772122 Rv -> 314 -------- |
|||
03-18-2019, 08:07 AM
Post: #26
|
|||
|
|||
RE: Happy Pi day everyone!!
(03-16-2019 03:18 PM)Thomas Klemm Wrote:(03-16-2019 07:50 AM)EdS2 Wrote: Indeed - a clue would be nice! Please? Thanks! That led to Kevin Brown's Rounding Up To PI - MathPages. |
|||
03-18-2019, 05:40 PM
Post: #27
|
|||
|
|||
RE: Happy Pi day everyone!!
(03-18-2019 08:07 AM)EdS2 Wrote: Thanks! That led to Kevin Brown's Rounding Up To PI - MathPages. Here are other links that I found interesting: The Combinatorics of Mancala-Type Games: Ayo, Tchoukaillon, and 1/π Duane M. Broline, Daniel E. Loeb My Favorite Integer Sequences by N. J. A. Sloane Chapter 12 Tchoukaillon solitaire (or Mancala, or Kalahari) Quote:The sequence can be obtained by a sieving process: write 1, 2, . . . in a Cheers Thomas |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)