# You must ensure that the application you submit meets all technical/grading requirements. Your…

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:

• The application will have an appropriate title
• The user will be prompted for the number of times the calculation will iterate. Your program will validate that the user has entered a valid number and that the number is greater than 1 million.
• Using a loop, you will calculate the value of pi using the Leibniz formula and within the loop you will output the value of pi when the loop’s index is 10, 1000, 100000, 500000, 1000000, and then again at the end of the loop because we want to show the value of pi at the number of iterations specified by the user.
• The loop will end at the count provided by the user when the program started.
• In properly formatting your output the value of pi must be printed to 10 decimals while the iteration value must include the comma separators.

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:

• 10
• 1,000
• 100,000
• 500,000
• 1,000,000
• At the end of the loop determined by the value entered by the user.

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,

## Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
\$26
The price is based on these factors:
Number of pages
Urgency
Basic features
• Free title page and bibliography
• Unlimited revisions
• Plagiarism-free guarantee
• Money-back guarantee
On-demand options
• Writer’s samples
• Part-by-part delivery
• Overnight delivery
• Copies of used sources
Paper format
• 275 words per page
• 12 pt Arial/Times New Roman
• Double line spacing
• Any citation style (APA, MLA, Chicago/Turabian, Harvard)

# Our guarantees

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.

### Money-back guarantee

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.

### Zero-plagiarism guarantee

Each 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.

### Free-revision policy

Thanks 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.