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](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f510bced573_63666f510bc4e7fb.jpg)

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
Get step-by-step solutions from verified subject matter experts
