Question: 1 class Main 3public static void main(String [] args) [ double pi; approximate value to he computed int count; final double SYSTEM PI Math.PI; tinal

 1 class Main 3public static void main(String [] args) [ double

pi; approximate value to he computed int count; final double SYSTEM PI

1 class Main 3public static void main(String [] args) [ double pi; approximate value to he computed int count; final double SYSTEM PI Math.PI; tinal double ONE_ THOUSANDETH -1.E-03; final double ONE_HUNDREDTHOUSANDETH 1.E-05; // Your code goes here System "out , printf("Leibniz after %d iterations : system p: %f approx. p: %f ", count, SYS I EMP, pi); 18 12 13 Instructions from your teacher We learned in a previous assignment that there are many formulas that approximate the value of pi. Pi is an irrational number with an infinite number of digits. There is a representation provided by the Math package (Math.PI) that has this value: 3.14159265359 Let's call this the "system" value. In this assignment you will compute the valuc of pi using the Lcibniz formula using a loop. This formula is known to converge slowly so let's keep track of the number of iterations it takes to come within 1/1000 (one thousandth) of the system value. This is know as the tolerance value. So you want a loop like this computed value 1st term of leibniz formula count1 while (abs (system valuc-computod valuo) >tolerance) adjust computed value by another term count++ end while Here is the Leibniz formula again

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!