Re: Is linux your daily driver? Hardware and Software Linux and Unix by Reverend Jim I've tried loinux several times over the years on spare computers, virtual machines, and a Raspberry Pi. I gave up on all of them because it was too difficult to maintain. Now all I use it for is Live USB recovery tools. Re: Director of Innovative Technologies Labs Community Center Say Hello! by Dani Hello and welcome to DaniWeb. That’s quite the CV you’ve got there. :) Pi ! Programming Software Development by skatamatic I've recently made a pi calculator out of a pretty rediculous algorithm (which is incredible …; setprecision(16) << fixed << dPi; dAccuracy = ((dPi / PI) * 100); cout << "\nApproximate Accuracy: " <<… pi Programming Software Development by laleh.97  We estimate pi.  We assume as in Figure 10 is a side of … your account.  This ratio is equal to one-fourth of pi.  Find a way to write the function to determine the… Re: pi Programming Software Development by Banfa … points in a quadrant of a circle from 0.785398(PI/4) to 0.570248 when you only consider integer points… suggests this isn't a terribly good method to approximate PI. Using 10500+ random points the result of the formula when… Pi Approximation with Taylor Series Programming Software Development by lwarshaw19 …= 2.97604617604617560644 Sample Run 4: This program approximates pi using an n-term series expansion. Enter the value…cmath> using namespace std; int main () { double pi = 0; double i; int n; cout<<"…;This program approximates pi using an n-term series expansion."<… Re: Pi Approximation with Taylor Series Programming Software Development by Lucaci Andrew …`'.'`). cout.precision(20); cout<<"pi"<<"["<<i<… like this: /* * Output */ This program approximates pi using an n-term series expansion. Enter the value of…series expansion. Enter the value of n>15 pi[15] = 3.2081856522619416339 Also, I let myself… Re: Pi Approximation Programming Software Development by loga88 …> => 3 > Approximation value of pi is 3.466667. #include <iostream> #…using namespace std; int main() { double pi = 0; // Calculating pi/4 int elements; cout<<"…2*n-1); } // Calculating pi pi *= 4; cout<<"Estimated PI value (" << … Re: Pi Approximation Programming Software Development by BountyX …<math.h> int main() { double pi = 0; // Calculating pi/4 int elements = 2000; for (long int n…)/(2*n-1); } // Calculating pi pi *= 4; cout << "Estimated PI value (" << elements…<< " elements): "<< pi; return 0; } As you can see I left some… Re: Pi Approximation Programming Software Development by essentialc++33 …gt; int main() > { > double pi = 0; // Calculating pi/4 > int elements = 2000; >…1; n <= elements; n++) > { > pi += (double) pow(-1, n+1)/(2*n-1); >…; } > // Calculating pi > pi *= 4; > cout << "Estimated PI value (" <<… Re: Pi Approximation with Taylor Series Programming Software Development by vijayan121 …need the expensive and approximate `std::pow()`. Something like this: // pi = 4 * ( 1 - 1/3 + 1/5 - … 1/9 - 1/11 + ... ) int sign = +1 ; double pi = 0.0 ; constexpr int n = 1000000 ; for( int i =… 0 ; i < n ; ++i ) { pi += sign * 4.0 / ( i*2 + 1 ) ; sign = -sign ;… Pi to many decimal places Programming Software Development by penguino138 Ok so i want to make a program that calculates pi. Ive done that already but it only gives me so ….h> #include <math.h> int main() { double pi = 0; int elements; cout << "How many???"…) pow(-1, n+1)/(2*n-1); } pi *= 4; cout << "Estimated PI value (" << elements <<… Re: Pi Approximation with Taylor Series Programming Software Development by lwarshaw19 My output looks like this: Enter the value of n>3 pi[3] = 12 For any number I put as the value of n... it gives me the answer 12.. just confused as to what I'm doing wrong.. My output should also show the terms used .. like if my n (number of terms) was 3.. then it should show: `pi[3] = 4[1 - 1/3 + 1/5] = (my answer)` Re: Pi Approximation with Taylor Series Programming Software Development by iamthwee … getting the answer 12. If you comment out the line `pi *=4;` you should get a value such as 3.14… you get. for (double n = 1; n <= i; n++) { pi += (double) pow(-1.0, n+1)*(4/(2*n-1… Re: Pi Approximation with Taylor Series Programming Software Development by iamthwee >For any number I put as the value of n... it gives me the answer 12.. A healthy adding of couts at strategic places could help your cause. >My output should also show the terms used .. like if my n (number of terms) was 3.. then it should show: pi[3] = 4[1 - 1/3 + 1/5] = (my answer) This could be solved by using cout in your `for` loop Re: Pi Approximation with Taylor Series Programming Software Development by iamthwee Additionally why are you doing this `pi *= 4;` when you are already multiplying by four in the for loop? Re: Pi Approximation with Taylor Series Programming Software Development by p s suvin whats the series expansion of pi power4 divided by 180 Pi Approximation Programming Software Development by essentialc++33 … be determined by the series equation PI=4x(1-1/3+1/5-1/… manu terms of series equation to use in approximating PI. Then calculate and display the approximation. Here is… a sample run: PI Approximation Program How many terms of the series should… the approximation) => 3 Approximation value of pi is 3.466667. Re: Pi Approximation Programming Software Development by essentialc++33 …{ [/size][size=2][color=#0000ff]double[/color][/size][size=2] pi =3.14159265358979323846; [/size][size=2][color=#008000]//approximate value of… many terms of the series equation to use in approximating pi"<< endl; cin >> enter …terms; cout << "approximate value of pi is"<< endl; return 0; } I don… Re: Pi Approximation Programming Software Development by essentialc++33 …[/size][size=2][color=#0000ff]double[/color][/size][size=2] pi =3.14159265358979323846; [/size][size=2][color=#008000]//approximate value of…many terms of the series equation to use in approximating pi"<< endl; cin >> enter …terms; cout << "approximate value of pi is"<< endl; [/size][size=2][color=#… Re: Pi Approximation Programming Software Development by beginner_199 … code get_pie(pie_answer); //calculating the answer of pi return_pie(pie_answer); getchar(); return 0; } //**********************************************************************… //this function will calculate the answer to pi void get_pie(double& pie_answer); { int… Re: pi.cpp Programming Software Development by kbshibukumar [QUOTE=72246;778739]calculate the value of pi from in finite series pi=4-(4/3)+(4/5)-(4/7)+(4/9)-(4/11).... print a table that shows the approximate value of pi 1,000 terms series[/QUOTE] How the value of PI can be printed as a table? Re: Pi to many decimal places Programming Software Development by gusano79 … you use. There are methods for calculating the digits of pi that don't need arbitrary-precision arithmetic, for example, [URL… Re: Pi to many decimal places Programming Software Development by griswolf …. For instance [URL="http://www.math.com/tables/constants/pi.htm"]1000 digits (and formulae)[/URL] or [URL="… Re: Pi to many decimal places Programming Software Development by penguino138 So if i did calculate pi how would i take the individual parts of the fraction and store them into an int? Re: Pi to many decimal places Programming Software Development by TrustyTony If you only want to regenerate decimals of value of pi, you might adapt this Python code to C. [url]http://www.daniweb.com/software-development/python/code/362329[/url] Surely there exist ready implementations similar in C, but I assume you need to do something yourself to learn something. Re: Pi to many decimal places Programming Software Development by penguino138 In terms of data types, which holds the most decimal places? Im working on deriving a formula that will calculate parts of the decimal parts of pi? Is that the approach you guys would take? Re: Pi Approximation Programming Software Development by Dani [QUOTE=essentialc++33]Approximation value of pi is 3.466667.[/QUOTE] Don't you mean ~3.1415 ... ?? pi.cpp Programming Software Development by 72246 calculate the value of pi from in finite series pi=4-(4/3)+(4/5)-(4/7)+(4/9)-(4/11).... print a table that shows the approximate value of pi 1,000 terms series Re: pi.cpp Programming Software Development by ddanbe arctan(1)=pi/4 wich means : the arc wich has 1 as tan is equal to pi/4 radians. SEries expansion gives : arctan(1) = 1-1/3+1/5-1/7.... so pi/4 = 1-1/3+1/5-1/7.... 1-1/3+1/5-1/7....can be easily computed.