Pi Approximation: can be computed using the following Nilakantha formula: II = 3 + 4/(2*3*4) -...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Pi Approximation: can be computed using the following Nilakantha formula: II = 3 + 4/(2*3*4) - 4/ (4*5*6) + 4/ (6*7*8) - 4/(8*9*10) + 4/(10*11*12)... or, where t = term, and i = iteration: π Value t 1 3.16 3.14 3.12 3.1 3.08 Notice the pattern in the denominators above, and the sign alternates to its opposite (positive to negative, negative to positive, etc.). This can be coded as a "for" loop where you initialize the variable "sign" as a positive 1 before the loop body, and then multiply it by negative 1 inside the loop to change the sign for each iteration of the loop. Here is a graph of the values after the first four iterations: 3.06 3.04 3.02 = 3 3.1666666667 4/(2*3*4) 1 3 = = 0 3. + 0 3.13333333333 3.14523809524 3.13968253968 4/(4*5*6) + 4/(6*7*8) 4/(8*9*10) + 2 3 4 3.166667 1 3.133333 Greater than or equal to 3.14 and less than 3.15 4/((21)*(2*i+1)*(2*i+2)) i Iteration 3.145238 Python 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 AMD64)] on win32 Type "help", "copyright", "credits" or "license ()" for more information Nilakantha's Approximation of n The value of n is 3.1415926228 when i = 200 The value of n is 3.1415926516 when i = 500 The value of n is 3.1415926533 when i = 1000 The number of iterations to get to 3.14159265 is Create a Python program called "ApproximatingPi.py" that displays the following values for i = 200, i = 500, and i = 1000. Then, determine exactly which iteration causes the value of to reflect 3.14159265... In other words, determine when a becomes greater than or equal to 3.14159265 and less than 3.14159266. Print out this iteration and value of at the end of your output (after the values of are printed out at iterations 200, 500, and 1000). You can print out the ** character by using the Unicode escape sequence \u03c0 inside a string. All output should be done using the format() function, and decimals should go to the 10th decimal place. RESTART: C:/$userDellKC/Classwork/FSW/COP1000 - Intro to Computer Pro McMullen/Exercises/Module 07/Kerry Cramer ApproximatingPi.py 3.139682 II= ?????? ???? PI Value Pi Approximation: can be computed using the following Nilakantha formula: II = 3 + 4/(2*3*4) - 4/ (4*5*6) + 4/ (6*7*8) - 4/(8*9*10) + 4/(10*11*12)... or, where t = term, and i = iteration: π Value t 1 3.16 3.14 3.12 3.1 3.08 Notice the pattern in the denominators above, and the sign alternates to its opposite (positive to negative, negative to positive, etc.). This can be coded as a "for" loop where you initialize the variable "sign" as a positive 1 before the loop body, and then multiply it by negative 1 inside the loop to change the sign for each iteration of the loop. Here is a graph of the values after the first four iterations: 3.06 3.04 3.02 = 3 3.1666666667 4/(2*3*4) 1 3 = = 0 3. + 0 3.13333333333 3.14523809524 3.13968253968 4/(4*5*6) + 4/(6*7*8) 4/(8*9*10) + 2 3 4 3.166667 1 3.133333 Greater than or equal to 3.14 and less than 3.15 4/((21)*(2*i+1)*(2*i+2)) i Iteration 3.145238 Python 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 AMD64)] on win32 Type "help", "copyright", "credits" or "license ()" for more information Nilakantha's Approximation of n The value of n is 3.1415926228 when i = 200 The value of n is 3.1415926516 when i = 500 The value of n is 3.1415926533 when i = 1000 The number of iterations to get to 3.14159265 is Create a Python program called "ApproximatingPi.py" that displays the following values for i = 200, i = 500, and i = 1000. Then, determine exactly which iteration causes the value of to reflect 3.14159265... In other words, determine when a becomes greater than or equal to 3.14159265 and less than 3.14159266. Print out this iteration and value of at the end of your output (after the values of are printed out at iterations 200, 500, and 1000). You can print out the ** character by using the Unicode escape sequence \u03c0 inside a string. All output should be done using the format() function, and decimals should go to the 10th decimal place. RESTART: C:/$userDellKC/Classwork/FSW/COP1000 - Intro to Computer Pro McMullen/Exercises/Module 07/Kerry Cramer ApproximatingPi.py 3.139682 II= ?????? ???? PI Value
Expert Answer:
Related Book For
Basic Technical Mathematics
ISBN: 9780137529896
12th Edition
Authors: Allyn J. Washington, Richard Evans
Posted Date:
Students also viewed these programming questions
-
The ledger of Sunland Company contains the following balances: Owner s Capital $ 2 8 , 9 0 0 , Owner s Drawings $ 2 , 1 0 0 , Service Revenue $ 5 1 , 0 0 0 , Salaries and Wages Expense $ 2 6 , 4 0...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
A large advertising firm specializes in creating television commercials for childrens products. The firm wants to design a study to investigate factors that may affect the lengths of time a...
-
In July 2009, Malcolm bought a piece of land for 40,000. In June 2016 he sold part of the land for 11,000. This disposal was not caused by a compulsory purchase and was his only disposal of land in...
-
We estimate that 270 million plug-in electric clocks are in the United States, approximately one clock for each person. The clocks convert energy at the average rate 2.50 W. To supply this energy,...
-
An automobile traveling at a speed of 30.0 m/s applies its brakes and comes to a stop in 5.0 s. If the automobile has a mass of 1.0 103 kg, what is the average horizontal force exerted on it during...
-
On March 23, 2005, a hydrocarbon vapor cloud explosion occurred at the isomerization process unit at BP's Texas City Refinery in Texas City, Texas, killing 15 workers and injuring more than 170...
-
Baker Brothers has a DSO of 40 days, and its annual sales are $7,300,000. What is its accounts receivable balance? Assume that it uses a 365-day year.
-
Create a research paper outline about The Right to Abortion. The outline should make your points, in abbreviated form, and include your supporting evidence - i.e., cases (including the 4 legal codes...
-
Is there a relationship between wing length (mm) and wing beat frequency (Hz) among hummingbirds? In one study, researchers measured the wing lengths and wing beat frequencies of 12 hummingbirds.3...
-
The dollar amount of desired profit from the production and sale of the company's product is: a. $ 96,000 b. $105,840 c. $225,000 d. $220,500
-
You sell high-end shoes in New York City. Virtually all of your target market lives in NYC or the immediately surrounding suburbs. You have one store on 52nd Street and Fifth Avenue in Manhattan....
-
I used Indeed.com to research IT job careers that required Linux Administrator skills inmy area. 2.Examine three job openings that you think match the skills you learned during the course.The...
-
IN US, All workers are entitled to a minimum wage. Without a minimum wage system, workers would likely be paid a lower amount of wages for their work. Assume now that Country f would like to learn...
-
Search Engine Advertising: Paid Clicks vs. Organic clicks (10 points) Nancy, a micro-entrepreneur, operates an online store that sells gardening items. She is considering employing paid search...
-
1. A. Discuss why organizations need to experience change?? Explain using scientific proofs. B. Evaluate the following situations in terms of change process and change types. Explain using scientific...
-
In a single throw with two dice, find the probability that their sum is a multiple either of 3 or 4. a. 1/3 b. 1/2 c. 5/9 d. 17/36
-
Periwinkle Company is a multinational organization. Its Parts Division is located in Lavender Land, while its Assembly Division is located in North Orchid. During the current year Periwinkle Companys...
-
Make the given changes in the indicated examples of this section and then solve the resulting problems. In Example 7, change the to + and then find . Data from Example 7 Given that cos = 0.1298,...
-
Measured on the Richter scale, the magnitude of an earthquake of intensity I is defined as R = log(I /I 0 ), where I 0 is a minimum level for comparison. How many times I 0 was the 1906 San Francisco...
-
Identify the curve represented by each of the given equations. Determine the appropriate important quantities for the curve and sketch the graph. x 2 = 8(y x 2)
-
Consider a binary equimolar mixture of acetone and chloroform at \(300 \mathrm{~K}\) and \(1 \mathrm{~atm}\). Because this mixture forms a binary azeotrope, methyl- \(n\)-pentyl ether solvent is used...
-
A system of three parallel reactions (Trambouze and Piret, 1959) involves the following reaction scheme: \[\mathrm{A} \xrightarrow{k_{1}} \mathrm{~B} \quad \mathrm{~A} \xrightarrow{k_{2}} \mathrm{C}...
-
Repeat Exercise 8.1, taking the first two reactions as first order, and the last as second order with \(k_{1}=0.02 \mathrm{~min}^{-1}, k_{2}=0.2 \mathrm{~min}^{-1}\), and \(k_{3}=2.0 \mathrm{~L} /...
Study smarter with the SolutionInn App