Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-06-2005, 06:24 PM   #1
LQ Newbie
Registered: Jan 2005
Posts: 17

Rep: Reputation: 0
need help with pi calculations!

Its been a while sence ive used any unix system, and im wondering if i could get some help from someone with more exp. than me. I woudnt think this would be a complicated program to make for someone with exp.

I need a program that can calculate pi, but is unrestricted. Ive tried a few and there generally limited to 9m or so, i need something that can go as long as i need it too. If anyone could cook up something or tell me where to find such a program i would really appreciate it!

Old 01-06-2005, 07:15 PM   #2
Registered: Jan 2005
Location: MA
Distribution: Ubuntu 7.10
Posts: 558

Rep: Reputation: 30

use this formula to calculate pi

4* (Sigma(from k=0 to n) of ((-1)^(K+1))/(2K-1)

as you increase n you increase your accuracy
Old 01-06-2005, 07:21 PM   #3
Registered: Jan 2005
Location: MA
Distribution: Ubuntu 7.10
Posts: 558

Rep: Reputation: 30
Wait speed

That equation may be to slow now that i think about it. You will need to have n = around 300 inorder to get two digits of accuracy.

you may want to try this.

pi = sqrt(6* (Sigma (from k = 1 to n) of 1/(n^2)))
likewise as n increases so does accuracy


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
threads for mathematical calculations? skywalker27182 Programming 3 02-13-2005 10:25 AM
rough MySQL size calculations? benbroad Linux - Software 2 12-02-2004 06:01 AM
Date calculations in BASH script Crashman Programming 4 07-03-2004 10:15 AM
EIGRP and IGRP metric calculations dai Linux - Networking 1 12-16-2002 02:59 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:24 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration