Jump to content

IsaacAsimov

Senior Members
  • Posts

    97
  • Joined

  • Last visited

Everything posted by IsaacAsimov

  1. Perfect Pi Formula: I am still programming on a Commodore 64 computer because it still works, I am familiar with it, it has a good programming language, namely BASIC, and I can program in Structured BASIC. I tried your short program, and I got a value of pi = 3.14159266 On my computer keyboard, there is a special character for pi, which I can get by pressing <shift> [math]\pi[/math] Here is the program: 10 PRINT [math]\pi[/math] I get a value for pi= 3.14159265 If I press the <shift> [math]\pi[/math] button on my calculator, I get a value of pi= 3.141592654 Here is the Perfect Pi Program: 10 REM PERFECT PI PROGRAM 14 REM FROM ATN PI AND SIMPLE PI 20 PRINT "ATN PI =" 30 PRINT 4*ATN(1) 34 PRINT 40 PRINT "SIMPLE PI =" 50 PRINT [math]\pi[/math] I think the ATN formula you gave me is the perfect pi formula. Congratulations!
  2. This is the formula you gave us: [math] \pi=4\cdot arctan(1)=4\sum_{n=0}^{\infty}\frac{(-1)^n\cdot 1^{2n+1}}{2n+1}=4\sum_{n=0}^{\infty}\frac{(-1)^n}{2n+1} [/math] I wrote a small computer program on my C64 computer using this formula. It doesn't converge on pi fast enough. Even after 1000 runs through the loop, which took 57 seconds, the only correct part was 3.14
  3. Pi 16k Formula: Here is the most perfect pi formula I have ever found. It converges on pi very quickly, and doesn't need to use factorials. [math] \pi=\sum_{k=0}^{\infty} \frac{1}{16^k} \left( \frac{4}{8k+1}-\frac{2}{8k+4}-\frac{1}{8k+5}-\frac{1}{8k+6} \right) [/math] Here is the program to go with the formula. I wrote it in Structured BASIC on my C64 computer. You can use values of k from 0 to 31 on the C64 without getting an error. It is a very short program. 100 REM PI 16K 120 REM FROM PI FORMULA USING 16^K 140 REM 160 CALL MAIN 180 END 200 : 220 PROC MAIN 240 .....L=10 260 .....REM PRINT "A",,"S" 280 .....K=-1 300 .....LOOP 320 ..........K=K+1 340 ..........A=(1/(16^K))*((4/(8*K+1))-(2/(8*K+4))-(1/(8*K+5))-(1/(8*K+6))) 360 ..........S=S+A 380 ..........REM PRINT A,S 400 .....UNTIL K=L 420 .....PI=S 440 .....PRINT:PRINT "PI =";PI 460 ENDPROC
  4. I would like to discuss numerology, which is the study of numbers in everyday life. You can assign a different number to every letter of the alphabet, so a=1, b=2, c=3, ... ,z=26. You could add up the number for each letter in a word, so the word 'rat' would be r=18, since it is the 18th letter of the alphabet, a=1, since it is the 1st letter of the alphabet, and t=20, since it is the 20th letter of the alphabet. 18+1+20=39, so 'rat' would equal 39. You could do the same for other words. A different numerology method would be to accept every prime number as good, and since every composite number is a product of factors of prime numbers, every composite number could be accepted as good. Since there are only prime and composite natural numbers, every number can be accepted as good. Please let me know what you think of these numerology methods. Best wishes, IsaacAsimov
  5. In 1989, the Chudnovsky brothers correctly computed pi to over a 1 billion decimal places on the supercomputer IBM 3090 using the following variation of Ramanujan's infinite series of pi: Here is a computer program I wrote in Structured BASIC on my C64 computer which computes the above formula (includes a procedure for finding factorials). 100 REM PI CHUD 110 REM FROM THE CHUDNOVSKY BROTHERS 112 REM DOTS REPRESENT INDENTATIONS 120 REM 140 CALL INIT 160 CALL MAIN 180 CALL OUTPUT 200 END 220 : 240 PROC INIT 260 .....L=1 280 ENDPROC 300 : 320 PROC MAIN 340 .....A=12 360 .....K=-1 380 .....LOOP 400 ..........K=K+1 420 ..........P=6*K 440 ..........CALL FACT 460 ..........F1=F 480 ..........P=3*K 500 ..........CALL FACT 520 ..........F2=F 530 ..........P=K 532 ..........CALL FACT 534 ..........F3=F 540 ..........B=(-1)^K*F1*(13591409+545140134*K)/(F2*F3^3*640320^(3*K+3/2)) 560 ..........S=S+B 580 ..........REM PRINT S 600 .....UNTIL K=L 620 .....P1=A*S 640 .....PI=1/P1 660 ENDPROC 680 : 700 PROC OUTPUT 720 .....PRINT:PRINT "PI =";PI 740 ENDPROC 760 : 780 PROC FACT 800 .....I=P 820 .....F=1 840 .....LOOP 860 ..........F=F*I 880 ..........I=I-1 900 ..........REM PRINT I;F 920 .....UNTIL I<=0 940 .....IF I=-1 960 ..........F=1 980 .....ENDIF 990 ENDPROC
  6. In 1910, the Indian mathematician Srinivasa Ramanujan found several rapidly converging infinite series of pi, including which computes a further eight decimal places of pi with each term in the series. His series are now the basis for the fastest algorithms currently used to calculate pi. Here is a program I wrote in Structured BASIC with my C64 computer which computes the above formula: 100 REM PI RAMA 110 REM FROM SRINIVASA RAMANUJAN 120 REM 140 CALL INIT 160 CALL MAIN 180 CALL OUTPUT 200 END 220 : 240 PROC INIT 260 .....L=3 280 ENDPROC 300 : 320 PROC MAIN 340 .....A=2*SQR(2)/9801 360 .....K=-1 380 .....LOOP 400 ..........K=K+1 420 ..........P=4*K 440 ..........CALL FACT 460 ..........F1=F 480 ..........P=K 500 ..........CALL FACT 520 ..........F2=F 540 ..........B=F1*(1103+26390*K)/(F2^4*396^(4*K)) 560 ..........S=S+B 580 ..........REM PRINT S 600 .....UNTIL K=L 620 .....P1=A*S 640 .....PI=1/P1 660 ENDPROC 680 : 700 PROC OUTPUT 720 .....PRINT:PRINT "PI =";PI 740 ENDPROC 760 : 780 PROC FACT 800 .....I=P 820 .....F=1 840 .....LOOP 860 ..........F=F*I 880 ..........I=I-1 900 ..........REM PRINT I;F 920 .....UNTIL I<=0 940 .....IF I=-1 960 ..........F=1 980 .....ENDIF 990 ENDPROC
  7. The important part though is the summation or the last variant thereof: which if you make a little program and make n sufficiently large you will see Here is a program I wrote in Structured BASIC on my C64 computer which computes the above formula. 100 REM PI USING 4 120 : 140 CALL INIT 160 CALL MAIN 180 CALL OUTPUT 190 END 200 : 220 PROC INIT 240 .....N=10 300 ENDPROC 320 : 340 PROC MAIN 350 .....A=1/N 352 .....PRINT " I ";" B ",," S " 360 .....I=0 380 .....LOOP 400 ..........I=I+1 420 ..........B=SQR((4*N*N)/(4*N*N-4*I*I+4*I-1)) 440 ..........S=S+B 460 ..........PRINT I;B;S 480 .....UNTIL I=N 490 .....P1=A*S 500 .....PI=P1*2 520 ENDPROC 540 : 560 PROC OUTPUT 580 .....PRINT:PRINT "PI =";PI 60O ENDPROC
  8. [math] \text {Proof that } a^2=b^3 \text { has solutions}, a, b = I > 1 [/math] [math] a^2=b^3 (1) [/math] [math] \sqrt{a^2}=\sqrt{b^3} [/math] [math] a=b^\frac{3}{2} [/math] [math] a=\sqrt{b}^3 (2) [/math] [math] b=4: (2) a=\sqrt{4}^3 [/math] [math] =2^3 [/math] [math] =8 [/math] [math] (1) a^2=b^3 [/math] [math] 8^2=4^3 [/math] [math] 64=64 [/math] [math] LS=RS [/math] [math] \text{Therefore proven} [/math] [math] b=9: (2) a=\sqrt{9}^3 [/math] [math] =3^3 [/math] [math] =27 [/math] [math] (1) 27^2=9^3 [/math] [math] 729=729 [/math] [math] LS=RS [/math] [math] \text{Therefore proven} [/math]
  9. It looks like you put a lot of effort into this post. The formulas you use are very complicated. Unfortunately, I don't know what any of it means, except it has something to do with pi, which is worthy in itself.
  10. There's a formula very similar to the formula you have given in post #21 of this thread. Check it out.
  11. Here's a new factorial function I invented that uses the Fibonacci sequence 1,1,2,3,5,... The Fibonacci Factorial, or Fib! is defined as the product of all the Fibonacci numbers up to n. Examples: 1Fib!=1, 2Fib!=1*1*2=2, 3Fib!=1*1*2*3=6, 4Fib!=undefined, 5Fib!=1*1*2*3*5=30 I don't know if this function would be useful for mathematics. Please give me some input. Isaac
  12. Here's a Structured BASIC program I wrote on my C64 computer that computes the even/odd pi formula shown above. 100 REM EVEN/ODD PI FORMULA 110 REM DOTS REPRESENT INDENTATIONS 120 CALL INIT 140 CALL MAIN 160 CALL OUTPUT 180 END 190 : 200 PROC INIT 220 .....TI$="000000" 240 .....EV=0:OD=1 260 .....P=1 280 .....L=500 300 .....EP=2*L-2 320 ENDPROC 340 : 360 PROC MAIN 380 .....M=1 400 .....REM PRINT"EV";" OD ";"F",,"P" 420 .....PRINT 440 .....LOOP 460 ..........M=M+1 480 ..........EV=2*M-2 500 ..........OD=2*M-1 520 ..........F=EV/OD 540 ..........P=P*F 560 ..REM PRINT EV;OD;F;P 580 .....UNTIL EV=EP 600 .....REM 620 .....A=P*SQR(2*M) 640 .....PI=2*A*A 660 .....REM 680 ENDPROC 700 : 720 PROC OUTPUT 740 .....PRINT:PRINT"A =";A 760 .....PRINT:PRINT"PI =";PI 780 .....PRINT:PRINT"TIME TAKEN = ";TI$ 800 ENDPROC
  13. Here's a program I wrote in Structured BASIC on my C64 computer. 100 REM COMPUTING PI USING TRAPEZOIDS 120 CALL INIT 140 CALL MAIN 160 CALL OUTPUT 180 END 20O : 220 PROC INIT 240 .....TI$="000000" 260 .....A=0 280 .....B=1 300 .....X%=1 320 .....N=10 340 ENDPROC 360 : 380 PROC MAIN 400 .....DX=(B-A)/N 420 .....PRINT:PRINT "DX =";DX 440 .....X=-DX 460 .....I=-1 480 .....PRINT:PRINT " I ";" X ";" Y ";" T ":PRINT 500 .....LOOP 520 ..........I=I+1 540 ..........X=X+DX 560 ..........D=1-X*X 580 ..........REM 600 ..........IF D<0 620 ...............D=0 640 ..........ENDIF 660 ..........REM 680 ..........Y=2*SQR(D) 700 ...........IF I=0 OR I=N 720 ................Y=Y/2 740 ...........ENDIF 760 ...........T=T+Y 780 ...........PRINT I;X;Y;T 800 .....UNTIL I=N 820 .....PI=DX/2*T*4 840 ENDPROC 860 : 880 PROC OUTPUT 900 .....PRINT:PRINT "PI =";PI 920 .....PRINT:PRINT "TIME TAKEN = ";TI$ 940 ENDPROC
  14. Here's a program I wrote in Structured Basic on my C64 computer: 100 REM COMPUTING PI USING RECTANGLES 110 REM DOTS REPRESENT INDENTATIONS 120 CALL INIT 140 CALL MAIN 160 CALL OUTPUT 180 END 200 : 220 PROC INIT 240 .....TI$="000000" 260 .....A=0:B=1 280 .....N=10 300 ENDPROC 320 : 340 PROC MAIN 360 .....DX=(B-A)/N 380 .....PRINT:PRINT"DX =";DX 400 .....X=-DX 420 .....I=-1 440 .....PRINT:PRINT" I ";" X ";" Y ";" T ":PRINT 460 .....LOOP 480 ........I=I+1 500 ........X=X+DX 520 ........Y=SQR(1-X*X) 540 ........T=T+Y 560 ........PRINT I;X;Y;T 580 .....UNTIL I=N-1 600 .....PI=DX*T*4 620 ENDPROC 640 : 660 PROC OUTPUT 680 .....PRINT:PRINT"PI =";PI 700 .....PRINT:PRINT"TIME TAKEN = ";TI$ 720 ENDPROC
  15. Here's a program I wrote in Structured BASIC on my C64 computer: 100 REM COMPUTING PI USING TRAPEZOIDS 110 REM DOTS REPRESENT INDENTATIONS 120 CALL INIT 140 CALL MAIN 160 CALL OUTPUT 180 END 200 : 220 PROC INIT 240 .....TI$="000000" 260 .....A=0 280 .....B=1 300 .....X%=1 320 .....N=10 340 ENDPROC 360 : 380 PROC MAIN 400 .....DX=(B-A)/N 420 .....PRINT:PRINT "DX =";DX 440 .....DX=-DX 460 .....I=-1 480 .....PRINT:PRINT" I ";" X ";" Y ";" T":PRINT 500 .....LOOP 520 ..........I=I+1 540 ..........X=X+DX 560 ..........D=1-X*X 580 ..........REM 600 ..........IF D<0 620 ..............D=0 640 ..........ENDIF 660 ..........REM 680 ..........Y=2*SQR(D) 700 ..........IF I=0 OR I=N 720 ..............Y=Y/2 740 ..........ENDIF 760 ..........T=T+Y 780 ..........PRINT I;X;Y;T 800 .....UNTIL I=N 820 .....PI=DX/2*T*4 840 ENDPROC 860 : 880 PROC OUTPUT 900 .....PRINT:PRINT"PI =";PI 920 .....PRINT:PRINT"TIME TAKEN = ";TI$ 940 ENDPROC
  16. Thank you for clearing that up. I guess I'll have to use a computer instead of a calculator. My calculator can handle numbers up to 69!, or 9.999...E+99, but using a calculator for the above even-odd formula is too time-consuming. I wrote a program for the even-odd formula on my C64 computer, and I got it right the first time! The only problem is that my computer can only handle numbers up to 1.7014E+38, or 33!, so I'm limited to m=10 for the even-odd formula, k=8 for the Ramanujan formula, and k=5 for the Chudnovsky formula.
  17. Another fun formula (due to Wallis) is When I tried to use this formula, I got: m=10: [math]a=\frac{384(2(10)-2)}{945(2(10)-1)}\sqrt{2(10)}=\frac{384(18)}{945(19)}\sqrt{20}=1.72160[/math] [math]a=\sqrt{\frac{\pi}{2}}[/math] [math]a^2=\frac{\pi}{2}[/math] [math]\pi=2a^2=2(1.72160)^2=5.92784[/math] which is clearly wrong m=100: [math]a=\frac{384(2(100)-2)}{945(2(100)-1)}\sqrt{2(100)}=\frac{384(198)}{945(199)}\sqrt{200}=5.71777[/math] [math]\pi=2a^2=2(5.71777)^2=65.38574[/math] which is also clearly wrong What am I doing wrong?
  18. Here's a program I wrote in Structured Basic on my C64 computer: 100 REM COMPUTING PI USING RECTANGLES 110 REM DOTS REPRESENT INDENTATIONS 120 CALL INIT 140 CALL MAIN 160 CALL OUTPUT 180 END 200 : 220 PROC INIT 240 .....TI$="000000" 260 .....A=0:B=1 280 .....N=10 300 ENDPROC 320 : 340 PROC MAIN 360 .....DX=(B-A)/N 380 .....PRINT:PRINT"DX =";DX 400 .....X=-DX 420 .....I=-1 440 .....PRINT:PRINT" I ";" X ";" Y ";" T ":PRINT 460 .....LOOP 480 ........I=I+1 500 ........X=X+DX 520 ........Y=SQR(1-X*X) 540 ........T=T+Y 560 ........PRINT I;X;Y;T 580 .....UNTIL I=N-1 600 .....PI=DX*T*4 620 ENDPROC 640 : 660 PROC OUTPUT 680 .....PRINT:PRINT"PI =";PI 700 .....PRINT:PRINT"TIME TAKEN = ";TI$ 720 ENDPROC
  19. Thank you for showing me those two approximation of pi formulas. I would use them, but my C64 computer doesn't have a factorial function. I am very fond of pi, and I like calculating pi, as long as it's not too complicated. Marlon S.
  20. [math]T_n=\frac{\Delta x}{2}[f(x_0)+2f(x_1)+2f(x_2)+...+2f(x_{n-1})+f(x_n)][/math] [math]\text{Rectangle and Trapezoid Methods:}[/math] [math] \begin{matrix} \text{number of rectangles} & \text{value of pi} & \text{number of trapezoids} & \text{value of pi} \\ 10 & 3.30452 & 10 & 3.10452 \\ 100 & 3.16042 & 100 & 3.14042 \\ 1000 & 3.14356 & 1000 & 3.14156 \end{matrix} [/math]
  21. I know that the integral formula equates to pi, however I was trying to find the decimal value of pi.
  22. Given: [math]y=\sqrt{1-x^2}[/math] =SQR(1-X*X) a=0, b=1, n=10 [math]\Delta x = \frac{b-a}{n}=\frac{1-0}{10}=\frac{1}{10} = 0.1[/math] [math] \begin{matrix} I & X & Y & T \\ 0 & 0 & 1 & 1 \\ 1 & 0.1 & 1.98997 & 2.98997 \\ 2 & 0.2 & 1.95959 & 4.94957 \\ 3 & 0.3 & 1.90788 & 6.85745 \\ 4 & 0.4 & 1.83303 & 8.69048 \\ 5 & 0.5 & 1.73205 & 10.42253 \\ 6 & 0.6 & 1.6 & 12.02253 \\ 7 & 0.7 & 1.42829 & 13.45081 \\ 8 & 0.8 & 1.2 & 14.65081 \\ 9 & 0.9 & 0.87178 & 15.52259 \\ 10 & 1 & 0 & 15.52259 \\ \end{matrix} [/math] [math]\pi=\frac{\Delta x}{2}(T)(4)=\frac{0.1}{2}(15.52259)(4) = 3.10452[/math] This is fairly close to the actual value of pi.
  23. T is the total of all the y values up to that point.
  24. Given: [math]y=\sqrt{1-x^2}[/math] =SQR(1-X*X) a=0, b=1, n=10 [math] \Delta x = \frac{b-a}{n}=\frac{1-0}{10}=\frac{1}{10} = 0.1[/math] [math] \begin{matrix} I & X & Y & T \\ 0 & 0 & 1 & 1\\ 1 & 0.1 & 0.99499 & 1.99499\\ 2 & 0.2 & 0.97980 & 2.97478\\ 3 & 0.3 & 0.95394 & 3.92872\\ 4 & 0.4 & 0.91652 & 4.84524\\ 5 & 0.5 & 0.86602 & 4.84524\\ 6 & 0.6 & 0.8 & 6.51126\\ 7 & 0.7 & 0.71414 & 7.22541\\ 8 & 0.8 & 0.6 & 7.82541\\ 9 & 0.9 & 0.43589 & 8.26130 \end{matrix} [/math] [math] \pi=\Delta x(T)(4)=0.1(8.26130)(4)=3.30452[/math]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.