This assignment does not exactly match the one in the textbook on which it is based.  I don't want any counter-controlled loops in your solution.  Your solution should be able to detect when the accuracy isn't improving and then display the results of the work (as outlined below): Look at Programming Exercise **5.25 in the textbook on approximating the value of π.  It is described as: π = 4 (  1 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 + ... + (-1)^(i+1)/(2i-1) ) Notice that Java has the best possible value of π that can be stored as a type double available as Math.PI (part of the java.lang package). See how close you can get to the best value of π using a loop with the above technique. Notice that the above implies you are testing the value of your own estimate as it approaches the best value available in Java (as a type double).  This would not be a pre-determined, counter-controlled loop.  You are testing the results (sentinel-controlled) until you reach a value with the minimum discrepancy against Math.PI.  If done correctly, you can get full credit but you will have trouble.  The point of this assignment is to illustrate the difficulty of implementing some pure-math algorithms with digital computing resources.  The goal is to have you experiment and notice the results of your various efforts.  While gaining the credit is easy, getting the best results is not. How many iterations did it take? How far off was your estimated value. Attach the source code (as a single dot java file) and include in the output your calculated value, the number of iterations it took and the discrepancy.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

This assignment does not exactly match the one in the textbook on which it is based.  I don't want any counter-controlled loops in your solution.  Your solution should be able to detect when the accuracy isn't improving and then display the results of the work (as outlined below):

Look at Programming Exercise **5.25 in the textbook on approximating the value of π.  It is described as:

π = 4 (  1 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 + ... + (-1)^(i+1)/(2i-1) )

Notice that Java has the best possible value of π that can be stored as a type double available as Math.PI (part of the java.lang package).

See how close you can get to the best value of π using a loop with the above technique.

Notice that the above implies you are testing the value of your own estimate as it approaches the best value available in Java (as a type double).  This would not be a pre-determined, counter-controlled loop.  You are testing the results (sentinel-controlled) until you reach a value with the minimum discrepancy against Math.PI.  If done correctly, you can get full credit but you will have trouble.  The point of this assignment is to illustrate the difficulty of implementing some pure-math algorithms with digital computing resources.  The goal is to have you experiment and notice the results of your various efforts.  While gaining the credit is easy, getting the best results is not.

How many iterations did it take?
How far off was your estimated value.

Attach the source code (as a single dot java file) and include in the output your calculated value, the number of iterations it took and the discrepancy.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education