You must ensure that the application you submit meets all technical/grading requirements. Your grade will be based on how well your application follows the application requirements plus the following:
How the application looks and how it presents its information to the user is up to you. But it must meet the minimum requirements noted above.
Assignment Requirements
The number p is a mathematical constant, the ratio of a circle’s circumference to its diameter, commonly approximated as 3.14159. It has been represented by the Greek letter “p” since the mid-18th century, though it is also sometimes spelled out as “pi.” Being an irrational number, p cannot be expressed exactly as a fraction (equivalently, its decimal representation never ends and never settles into a permanently repeating pattern).
In this application we are calculating the value of PI using a formula that dates from the 17th century. Specifically, we will use the Leibniz formula. This formula is a convergence sequence, which means that its partial sums tends to a limit; this means that the partial sums become closer and closer to a given number when the number of their terms increases. In short, the more times we perform this calculation we converge toward a more accurate value of the number pi.
In this assignment, you will construct a loop to perform the Leibniz formula at least 1 million times. And because the calculated value of pi will vary based on the number of times we perform this sequence I want to know what that value is at certain intervals of the loop. Specifically, you will print the calculated value of pi at the following loop intervals:
I do not want separate loops for each of these outputs. Your application should have a single loop that prints the value of pi at the above given iteration values.
Gregory/Leibniz Convergence Formula for Calculating PI
Either in a quest for precision or as mere feats of record-setting there seems to be a never-ending desire to calculate the value of p to the greatest number of digits possible. In fact, approximations for the value of p can be found in ancient Egypt, China, and India.
One formula to calculate p, developed by Gregory (1638-1675) and Leibniz (1646-1716), can be expressed as follows:
This formula represents a simple, infinite series, and is represented in summation notation.
Using this diagram as a guide to the Leibniz formula we understand that the formula to the right of the summation symbol is to be performed by substituting the index value into the formula. Furthermore, the number at the bottom of the symbol specifies the first number to be used while the value at the top of the symbol specifies when we should stop. In the Leibniz formula the upper bounds is infinity, thus we can choose to stop as we please.
Therefore, the first ten iterations of our formula must be as follows (remember zero to nine is a total of ten iterations and we must start at zero):
. . .
You will notice that the formula is a simple recurrence. And as the individual terms of this series are added to the sum the total gradually gets closer to p. However, this convergence sequence is inefficient as after 500,000 terms it produces only five correct decimal digits of p.
You should be able to see how each of these calculations should be performed in a loop. Within the loop, we need to keep a sum of the value of this sequence.
Our next step will be to find the value of PI at any given time. This is done by realizing that the sum of the above sequence is equal to . We need simply now to solve for . This means that equals 4 X the sum of the values from our sequence.
Hence,
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more