(01-04-2021 08:41 PM)Gerson W. Barbosa Wrote: The alternate sum of the factors of the Wallis product tends to \(\pi\)/4 - 1/2 as \(n\) tends to infinity:
\(\lim_{n\rightarrow \infty } \left [ \frac{1}{1\cdot 3}-\frac{1}{3\cdot 5}+\frac{1}{5\cdot 7}-\frac{1}{7\cdot 9}+\frac{1}{9\cdot 11}-\frac{1}{11\cdot 13}+\frac{1}{13\cdot 15}-\frac{1}{15 \cdot 17}\pm \cdots +\frac{(-1)^{n-1}}{4n^{2}-1}\right ]=\frac{\pi }{4}-\frac{1}{2}\)
We can use Valtentin's program
(11C) Summation of infinite, alternating series and adapt it for the
HP-15C:
Code:
001 { 42 21 11 } f LBL A
002 { 43 5 0 } g CF 0
003 { 44 .1 } STO 11
004 { 34 } X<=>Y
005 { 44 .0 } STO 10
006 { 1 } 1
007 { 44 8 } STO 8
008 { 0 } 0
009 { 44 9 } STO 9
010 { 44 25 } STO I
011 { 42 21 1 } f LBL 1
012 { 32 12 } GSB B
013 { 45 8 } RCL 8
014 { 44 30 8 } STO - 8
015 { 44 30 8 } STO - 8
016 { 20 } *
017 { 44 40 9 } STO + 9
018 { 42 6 25 } f ISG I
019 { 42 7 4 } f FIX 4
020 { 45 .0 } RCL 10
021 { 45 25 } RCL I
022 { 43 10 } g x<=y
023 { 22 1 } GTO 1
024 { 44 8 } STO 8
025 { 2 } 2
026 { 10 } /
027 { 42 44 } f FRAC
028 { 43 30 0 } g TEST 0
029 { 43 4 0 } g SF 0
030 { 43 35 } g CLx
031 { 44 25 } STO I
032 { 42 21 2 } f LBL 2
033 { 45 8 } RCL 8
034 { 32 12 } GSB B
035 { 44 24 } STO (i)
036 { 42 6 25 } f ISG I
037 { 42 7 4 } f FIX 4
038 { 1 } 1
039 { 44 40 8 } STO + 8
040 { 45 .1 } RCL 11
041 { 45 25 } RCL I
042 { 43 10 } g x<=y
043 { 22 2 } GTO 2
044 { 2 } 2
045 { 43 6 0 } g F? 0
046 { 16 } CHS
047 { 44 8 } STO 8
048 { 43 16 } g ABS
049 { 42 21 6 } f LBL 6
050 { 30 } -
051 { 44 25 } STO I
052 { 44 .2 } STO 12
053 { 42 21 0 } f LBL 0
054 { 45 24 } RCL (i)
055 { 42 6 25 } f ISG I
056 { 42 7 4 } f FIX 4
057 { 44 30 24 } STO - (i)
058 { 45 .1 } RCL 11
059 { 45 25 } RCL I
060 { 43 30 6 } g TEST 6
061 { 22 0 } GTO 0
062 { 45 .2 } RCL 12
063 { 44 25 } STO I
064 { 43 20 } g x==0
065 { 22 4 } GTO 4
066 { 1 } 1
067 { 22 6 } GTO 6
068 { 42 21 4 } f LBL 4
069 { 45 24 } RCL (i)
070 { 45 8 } RCL 8
071 { 10 } /
072 { 44 40 9 } STO + 9
073 { 2 } 2
074 { 16 } CHS
075 { 44 20 8 } STO * 8
076 { 42 6 25 } f ISG I
077 { 42 7 4 } f FIX 4
078 { 45 .1 } RCL 11
079 { 45 25 } RCL I
080 { 43 10 } g x<=y
081 { 22 4 } GTO 4
082 { 45 9 } RCL 9
083 { 43 32 } g RTN
This is subroutine
B to calculate the elements of the sequence:
Code:
084 { 42 21 12 } f LBL B
085 { 1 } 1
086 { 40 } +
087 { 43 11 } g x^2
088 { 4 } 4
089 { 20 } *
090 { 1 } 1
091 { 30 } -
092 { 15 } 1/x
093 { 43 32 } g RTN
Example
10 ENTER 7
GSB A
0.285398164
.5 +
4 ×
3.141592654
It takes about 1'24" to return the result.