Post Reply 
OEIS A229580 mini challenge (RPL)
05-02-2018, 02:59 AM (This post was last modified: 05-02-2018 12:19 PM by Gerson W. Barbosa.)
Post: #21
RE: OEIS A229580 mini challenge (RPL & RPN)
Here is my wp34s program:

001 LBL A
002 STO+ X
003 2^x
004 DEC L
005 RCL* L
006 #008
007 /
008 CEIL
009 END


I am looking forward to your RPN (better HP calculators, I now – but I was lazy) and RPL solutions.
Thank you all for your interest and participation!

Gerson.

Edited to fix a typo. Thank you, brickviking ! :-)
Find all posts by this user
Quote this message in a reply
05-02-2018, 03:49 AM
Post: #22
RE: OEIS A229580 mini challenge (RPL)
(05-02-2018 02:59 AM)Gerson W. Barbosa Wrote:  Here is my wp3s program:

Woo hoo! So not only have you done the WP34S and the WP31S, you've even done the WP3S? I'm astonished at your skills, guys.

Um, what calculator functions does it have?

(Post LOL 214)

Regards, BrickViking
HP-50g |Casio fx-9750G+ |Casio fx-9750GII (SH4a)
Visit this user's website Find all posts by this user
Quote this message in a reply
05-02-2018, 05:16 AM (This post was last modified: 05-02-2018 05:18 AM by Gerald H.)
Post: #23
RE: OEIS A229580 mini challenge (RPL)
My offering:

Code:
37.5

# 3095h

« DUP + 1 - 2 OVER 2 - ^ * CEIL
»

Very nice challenge, Gerson, thank you. I hope you will inform OEIS of your formula.

Well done Joe!
Find all posts by this user
Quote this message in a reply
05-02-2018, 12:14 PM
Post: #24
RE: OEIS A229580 mini challenge (RPL)
(05-02-2018 05:16 AM)Gerald H Wrote:  My offering:

Code:
37.5

# 3095h

« DUP + 1 - 2 OVER 2 - ^ * CEIL
»

Very nice challenge, Gerson, thank you. I hope you will inform OEIS of your formula.


Thank you, Gerald, but I think there is no problem if you inform them yourself. After all, in order do solve this little problem you’ve managed to derive a formula as well (as have others). I would suggest the formula valid for n > 1, that is, without the ceiling part.

I arrived at that OEIS sequence when testing a continued fraction with consecutive denominators 3, 20 and 112. Since a continued fraction is evaluated backwards, a recursive formula wouldn’t help.

Gerson.
Find all posts by this user
Quote this message in a reply
05-02-2018, 02:59 PM
Post: #25
RE: OEIS A229580 mini challenge (RPL)
(05-02-2018 12:14 PM)Gerson W. Barbosa Wrote:  I arrived at that OEIS sequence when testing a continued fraction with consecutive denominators 3, 20 and 112. Since a continued fraction is evaluated backwards, a recursive formula wouldn’t help.

Would you please elaborate on this ? What's the particular, complete continued fraction ? What makes you think a recursive formula wouldn't help ?

Regards.
V.
.

  
Find All My HP-related Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
05-02-2018, 04:02 PM (This post was last modified: 05-02-2018 04:11 PM by Gerson W. Barbosa.)
Post: #26
RE: OEIS A229580 mini challenge (RPL)
(05-02-2018 02:59 PM)Valentin Albillo Wrote:  
(05-02-2018 12:14 PM)Gerson W. Barbosa Wrote:  I arrived at that OEIS sequence when testing a continued fraction with consecutive denominators 3, 20 and 112. Since a continued fraction is evaluated backwards, a recursive formula wouldn’t help.

Would you please elaborate on this ? What's the particular, complete continued fraction ? What makes you think a recursive formula wouldn't help ?

Well, I've noticed that

\(\frac{\pi ^{2}}{8} \approx 1+\frac{1}{3^{2}}+\frac{1}{5^{2}}+\cdots +\frac{1}{\left ( 2n-1 \right )^{2}}+\frac{1}{4n+\frac{1}{3n+\frac{2^{4}}{20n+\frac{3^{4}}{112n}}}}\)

If I wanted to manually test the continuous fraction with the next few possible denominators, like 576, 2816, 13312... (A229580/2), then a recursive formula would surely have been of help, but if I decided to do it programmatically, with many more terms, then it would not. Anyway, it turns out that apparently the next term is not 256/576... but I had to check that out.

Thanks again for your interest!

Gerson.
Find all posts by this user
Quote this message in a reply
05-02-2018, 04:59 PM
Post: #27
RE: OEIS A229580 mini challenge (RPL)
(05-02-2018 04:02 PM)Gerson W. Barbosa Wrote:  
(05-02-2018 02:59 PM)Valentin Albillo Wrote:  Would you please elaborate on this ? What's the particular, complete continued fraction ? What makes you think a recursive formula wouldn't help ?

Well, I've noticed that

\(\frac{\pi ^{2}}{8} \approx 1+\frac{1}{3^{2}}+\frac{1}{5^{2}}+\cdots +\frac{1}{\left ( 2n-1 \right )^{2}}+\frac{1}{4n+\frac{1}{3n+\frac{2^{4}}{20n+\frac{3^{4}}{112n}}}}\)

If I wanted to manually test the continuous fraction with the next few possible denominators, like 576, 2816, 13312... (A229580/2), then a recursive formula would surely have been of help, but if I decided to do it programmatically, with many more terms, then it would not. Anyway, it turns out that apparently the next term is not 256/576... but I had to check that out.

Thanks again for your interest!

You're welcome, thanks for the explanation. Dealing with continued fractions and their theory is a math topic I find remarkably interesting so I welcome any challenge or problem having to do with them.

Regards.
V.

  
Find All My HP-related Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
05-02-2018, 08:59 PM
Post: #28
RE: OEIS A229580 mini challenge (RPL)
(05-02-2018 04:59 PM)Valentin Albillo Wrote:  You're welcome, thanks for the explanation. Dealing with continued fractions and their theory is a math topic I find remarkably interesting so I welcome any challenge or problem having to do with them.

However I think you were right in the first place, a recursive formula could have indeed been of help for my particular application. In the program below I have used a closed-form formula to compute the last denominator of the continued fraction, but I might as well have computed it using a recursive formula, every term being computed at each step of the first FOR-NEXT loop.

Regards,

Gerson.

===============

>list

10 DESTROY ALL
15 INPUT N
20 S1=0 @ S2=0 @ P=1
25 FOR I=1 TO N
30 P=4*P @ S1=S1+1/(2*I-1)^2
35 NEXT I
40 P=P/4 @ A=2*N-1 @ B=8*N+4 @ D=(2*N+1)*P
45 FOR I=N TO 1 STEP -1
47 PRINT D*A/B
50 S2=I^4/(D*N+S2) @ D=D*A/B @ A=A-2 @ B=B-8
55 NEXT I
60 S2=1/(4*N+S2)
65 PRINT 8*(S1+S2)

>run

? 12
 24117248
 5505024
 1245184
 278528
 61440
 13312
 2816
 576
 112
 20
 3
 .25
 9.86960440168
 
Find all posts by this user
Quote this message in a reply
05-03-2018, 05:11 PM
Post: #29
RE: OEIS A229580 mini challenge (RPL)
Gerson W. Barbosa Wrote:However I think you were right in the first place, a recursive formula could have indeed been of help for my particular application. In the program below I have used a closed-form formula to compute the last denominator of the continued fraction, but I might as well have computed it using a recursive formula, every term being computed at each step of the first FOR-NEXT loop

A few questions if you don't mind:

What's the origin of the hybrid formula (series + continued fraction) you're evaluating ? Is it original research on your part ? Does it actually converge to Pi\(^2\)/8 and do the coefficients of the continued fraction part actually belong to the OEIS series (divided by 2) or it's just a tentative conjecture ?

I could check the convergence myself but if you already know I'd rather ask and avoid wasting time rediscovering your knowledge. Also, you begin evaluating the continued fraction part starting with the last denominator and working iteratively upwards to the first. I'd do it the opposite way, starting at the top and going downwards to the last denominator because this way it's easier to visualize the alleged convergence as each new denominator is considered.

Regards.
V.
.

  
Find All My HP-related Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
05-03-2018, 07:51 PM (This post was last modified: 05-03-2018 08:37 PM by Gerson W. Barbosa.)
Post: #30
RE: OEIS A229580 mini challenge (RPL)
(05-03-2018 05:11 PM)Valentin Albillo Wrote:  
Gerson W. Barbosa Wrote:However I think you were right in the first place, a recursive formula could have indeed been of help for my particular application. In the program below I have used a closed-form formula to compute the last denominator of the continued fraction, but I might as well have computed it using a recursive formula, every term being computed at each step of the first FOR-NEXT loop

A few questions if you don't mind:

What's the origin of the hybrid formula (series + continued fraction) you're evaluating ? Is it original research on your part ?

Hello, Valentin,

No, I don't mind at all. That's a well known series, but I derived it in early 1983 when I was a Physics student who had just learned about Fourier series and decided to use them for an out-of-the-textbook application:

\(\pi = \int_{0}^{\pi }\left [ \frac{1}{2}+\frac{2}{\pi } \left ( \sin x+\frac{1}{3}\sin 3x+\frac{1}{5}\sin 5 x+\frac{1}{7}\sin 7x+\cdots \right )\right ]\)dx
\(\vdots\)
\(\pi =2\sqrt{2\sum_{n=1}^{\infty}\frac{1}{\left (2n-1 \right )^{2}} }\)

It worked, but would converge very slowly. Then I did a little more work and obtained

\(\pi =2\sqrt{1+2\sum_{n=1}^{\infty}\left ( \frac{1}{\left ( 2n-1 \right )^{2}}-\frac{1}{\left ( 2n-1 \right )\left ( 2n+1 \right )} \right )}\)

It didn't help much, but at least I could have \(\pi\) between two bounds.

I was bit disappointed two years later when I read in a Calculus book something like "in 1792 a French mathematician obtained this series for \(\pi\)", followed by one of the series above, I don't remember which.

I though I had lost them, but a few days ago I found the two sheets of papers I had written back then hiding between the pages of my Portuguese version of "The Elements of the Differential and Integral Calculus", by W. A. Granville, P. F. Smith and W. R. Longley. I know it is a useless series for computing \(\pi\), due to its extremely slow convergence rate, but I decided to play with it again just the same.


(05-03-2018 05:11 PM)Valentin Albillo Wrote:  Does it actually converge to Pi\(^2\)/8 and do the coefficients of the continued fraction part actually belong to the OEIS series (divided by 2) or it's just a tentative conjecture ?

The first part does converge, as we have seen, but the continued-fraction terms work only for the denominators up to 112*n. Incidentally 3, 20 and 112, when multiplied by two, match the second, third and fourth terms of the OEIS sequence, but that's all. For n = 1000, for instance, the first few denominators of the continued fraction (considering all numerators equal to 1), should be 4000, 3000, 1250, 1382, 1, 2, 1, 1, 5, 1. I don't think this continued fraction improvement should work for non-alternating series, though. For other alternating series I tried, like the one for the Reciprocal Fibonacci Constant, the denominators cycle between two values, for instance, 4n and 16n, while the numerators are second powers of consecutive integers. Since the numerators of this one appears to follow a fourth power pattern, I would guess the denominators would cycle between four values, but then again the original series is non-alternating, so this may be doomed to failure.


(05-03-2018 05:11 PM)Valentin Albillo Wrote:  I could check the convergence myself but if you already know I'd rather ask and avoid wasting time rediscovering your knowledge. Also, you begin evaluating the continued fraction part starting with the last denominator and working iteratively upwards to the first. I'd do it the opposite way, starting at the top and going downwards to the last denominator because this way it's easier to visualize the alleged convergence as each new denominator is considered.

Thank you very much for your offer. Please feel free to do any experiments if you think they're worthwhile. I hope my lack of formalism hasn't been a problem for the explanation you've requested.

Best regards,

Gerson.

P.S.:

The \(\pi\)/4 formula here is the example I meant, not the RFC formula. Sorry! Also, contrary to what I had stated, the latter is not an alternating series, so I may be wrong and perhaps there is a continued-fraction adjustment for the original \(\pi\)^2/8 series as well.
Find all posts by this user
Quote this message in a reply
05-03-2018, 08:31 PM
Post: #31
RE: OEIS A229580 mini challenge (RPL)
(05-03-2018 07:51 PM)Gerson W. Barbosa Wrote:  Thank you very much for your offer. Please feel free to do any experiments if you think they're worthwhile. I hope my lack of formalism hasn't been a problem for the explanation you've requested.

First of all, thanks a lot for your very detailed answer to my questions and for the time it surely took you to write it all down, much appreciated.

I knew about the Fourier series part, i.e. the convergent series, but I didn't know a thing about the continued fraction adjustment and whether it actually made the partial-series+fraction indeed converge, that's why I asked, and your answer made it all perfectly clear.

Thanks again and regards.
V.
.

  
Find All My HP-related Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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