The mathematician/philosopher Gottfried Wilhelm Leibnitz XXXXXXXXXXderived a calculation to approximate π with the following series expansion formula: Clearly, the more terms one includes, the closer...


The mathematician/philosopher Gottfried Wilhelm Leibnitz (1646-1716) derived a calculation to approximate π with the following series expansion formula:



Clearly, the more terms one includes, the closer to the actual value of π the answer becomes. The closeness might look like:


Δ = abs ( ( myPi – π ) / π )


Create a C++ program that asks the user to enter the desired relative tolerance. Then use a function (value-returning or void) called Pi_Whole to perform the calculations. Your program should use a while loop to converge on the solution so that the calculated value of π is within the tolerance to the real thing. The closeness Δ should be a very small number, like 0.00001. Don’t use any more iterations than necessary.



Hint, C++ calls π “M_PI” and it is accessed with the following two C++ statements:


#define _USE_MATH_DEFINES


#include

Jul 09, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here