Please turn in this assignment (and all future assignments for this course) by emailing them to me . Please use the subject of "Honors 270 HW3" (note that the spacing matters) for this assignment (if you use the link above, the subject will be added automatically). Please attach separately the source code to all the programs that you write for this assignment. Each program should be attached as separate file to make it easier for me to read them. When answering the questions themselves feel free to answer directly in the body of your message or attach your answers as a separate file. You may want to copy and paste the questions into your message.
Use the formula:
π = 4 ( 1 - 1/3 + 1/5 - 1/7 + ... )
Write a python program that uses a while loop to do this calculation.
Initially, have your code run through the while loop for 5 terms of this series, and print out the sum after each term.
Then have your program use an if statement to print out the approximation for π every time mth term of the series, where m is a value that you set in your program. Also have your program set so that it runs through n terms of the series, where n is another value set in the code.
Initially run your program with m=20 and n=1000. Attach results from this run to your assignment.
How accurate is this method of approximating π? How many terms in the series do you need to get pi right to 2 decimal places?
How many decimal places is this run good too?
For reference, to 100 decimal places π = 3.1415926535 8979323846 2643383279 5028841971 6939937510 5820974944 5923078164 0628620899 8628034825 3421170679