Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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) +

Pi Approximation: can be computed using the following Nilakantha formula: II = 3 + 4/ (2*3*4) - 4/ (4*5*6) +

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

Step by Step Solution

3.45 Rating (155 Votes )

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Basic Technical Mathematics

Authors: Allyn J. Washington, Richard Evans

12th Edition

0137529899, 9780137529896

More Books

Students also viewed these Programming questions

Question

Identify the reagents a?c in the following scheme: H.

Answered: 1 week ago