Post Reply 
Programming Exercise (HP-15C, 15C LE - and others)
04-15-2014, 04:41 PM (This post was last modified: 04-15-2014 04:49 PM by Gerson W. Barbosa.)
Post: #101
RE: Programming Exercise (HP-15C, 15C LE - and others)
(04-06-2014 06:24 AM)Thomas Klemm Wrote:  Now we have 3 different ways to calculate the same thing:
  1. Borwein's formula using tangent numbers
  2. Convergence acceleration using Euler's transformation
  3. Gerson's method using continued fractions

Do you have a proof of your formula or is it still a conjecture? Congratulations to your discovery! Your method appears to be more efficient than the other two.

Isn't this the same method used by Valentin in his original problem, only in continued fraction format? Anyway, the formula appears to hold, even when we have only two terms of the series, albeit converging very slowly in this case:

\[\ln (2)= 1-\frac{1}{2}+\frac{1}{3}-\frac{1}{4}+\cdots +\frac{1}{n-1}-\frac{1}{n}+\frac{1}{2n+1+\frac{1^{2}}{2n+1+\frac{2^{2}}{2n+1+\frac{3^{2}}{2n+1+​\frac{4^{2}}{2n+1+... }}}}}\]

...ln(2) = 0.6931471805599453094172321214581766
0001e000 2 0.6923076923076923076923076923076923
0001e001 2 0.6931477851289172043889025021100493
0001e002 2 0.6931471805715443422837621214224286
0001e003 2 0.6931471805599454334834722951537730
0001e004 2 0.6931471805599453094184811843330782
0001e005 2 0.6931471805599453094172321339572391
0001e006 2 0.6931471805599453094172321214583016
0001e007 2 0.6931471805599453094172321214581766



Here is a similar formula for π/4:

\[\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+...​ }}}}}\]

.......π = 3.141592653589793238462643383279503
00000009 2 3.141574838064079287182344939989334
00000099 2 3.141592651424974945646180479799372
00000999 2 3.141592653589572786959492672266442
00009999 2 3.141592653589793216377737847078192
00099999 2 3.141592653589793238460434495123538
00999999 2 3.141592653589793238462643162386710
09999999 2 3.141592653589793238462643383257414
99999999 2 3.141592653589793238462643383279500


About 2d/3 terms of the series and of the continued fraction, where d is the number of desired correct decimal places, appear to suffice:

0000010 10 0.6931471805599454035014297564573935
0000022 22 0.6931471805599453094172321214581766

0000011 10 3.141592653589793130085240933000310
0000021 22 3.141592653589793238462643383279502


This is the program to compute π:

Code:

001 LBL A
002 STO 00
003 STO 01
004 STO+ X
005 STO+ 01
006 STO+ 01
007 #000
008 DEC Y
009 RCL Y
010 DEC X
011 DEC X
012 RCL* Z
013 z<> L
014 1/x
015 +
016 RCL+ L
017 DSE Y
018 BACK 010
019 x<> Y
020 RCL+ 00
021 RCL Z
022 x²
023 x<> Y
024 /
025 RCL 01
026 RCL- 00
027 x<> 00
028 Rv
029 DSE Z
030 BACK 010
031 RCL+ 00
032 1/x
033 + 
034 STO+ X
035 STO+ X
036 END

Again, the second parameter has to be even. Also, due to a program limitation the first parameter has to be odd.

Cheers,

Gerson.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Programming Exercise (HP-15C, 15C LE - and others) - Gerson W. Barbosa - 04-15-2014 04:41 PM



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