BBS: Inland Empire Archive Date: 05-07-92 (20:44) Number: 130 From: ROB FLOR Refer#: NONE To: ANDY KIDLE Recvd: NO Subj: Programming Pi Conf: (2) Quik_Bas

AK>I need some help with a simple computer program (or what should be >simple for a semi-experienced programmer.) I need to program two >infinite mathematical series for finding pi. I have access to BASIC and >QUICKC for programming. Here are the two series, >so if you can help, let me know: AK>pi = 4(1 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 +......) The way I would approach this is to approach the limit of precision for the divisor, and then do the final division: DefDbl A-Z Y = .000000000000050'pick a cutoff near machine limitsSi = - 1 Divisor=1FORK = 3TO65535STEP2 ,K = 3.00000..., 5.00000..., 7.00..,etc X = Si * 1 \ k'-1/3, +1/5, -1/7 etcIf ABS(X) < YTHENEXITFOR'Machine's limit of computabiltyDivisor = Divisor + X'add XSi = Si * -1'flip sign for next computationNext Pi = 4 \ Divisor This is untested, so lets call it pseudocode. The alogorithm seems sound, but not a lot of thought went into it. AK>I'll have to write out the second one since their are no keys to >represent exponents and square roots: Exponent = ^ as in 2^3, square root = X^.5 Rob * OLX 2.2 * "Serfs up" - Nero --- WM v2.01/91-0156 * Origin: BEAR HEAVEN BBS (914) 677-6948 MILLBROOK NY (1:272/53)

Echo Basic Postings

**Books at Amazon:**

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET