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: 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:
Again, the second parameter has to be even. Also, due to a program limitation the first parameter has to be odd. Cheers, Gerson. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)