Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need help Part 1: Programming Problems (60pts) Pi (n) is one of the most important and fascinating numbers in mathematics. Roughly 3.14, it is a

need help image text in transcribed
image text in transcribed
image text in transcribed
Part 1: Programming Problems (60pts) "Pi (n) is one of the most important and fascinating numbers in mathematics. Roughly 3.14, it is a constant that is used to calculate the circumference of a circle from that circle's radius or diameter. It is also an irrational number, which means that it can be calculated to an infiniti number of decimal places without ever slipping into a repeating pattern. This makes it difficult, but not impossible, to calculate precisely". One way to determine the value of pi is using an infinite series. Similar to Newton's method for approximating square roots, the series approaches the real value of pi as more terms are included In this assignment, you are going to calculate pi using 4 different series/products, given the number of terms provided by the user. In addition to the result, your program should display the approximation error-how close your approximation is to the actual value of pi. Have your functions subtract the result from the value of math.pi to see how close it is. 1. Gregory-Leibniz series. Write a function, pi_gregory(n), to approximate the value of pi by adding the terms of the Gregory-Leibniz series, given below. 4 4 4 + 5 13 4 4 4 + - +... 7 9 11 Think carefully about how to switch between + and - for each term. There are multiple ways to accomplish this 2. Euler's method. Write a function pi_culer (n) that approximate the value of pi using Euler's method when Leonhard Euler solved the Basel problem: I 1 12 + 6. 1 1 + + 22 32 42 Note that the above formula yields * /6. 1 of 3 3. Wallis product Write a function pi_wallis(n) that approximates the value of pi using the Wallis product TE 2 2 4 4 6 6 8 2" 1'3'35'5'77 Note that the above formula yields 7 7/2 4. Nilakantha Series. Write a function pi_nilakantha (n) that approximates the value of pi using the Nilakantha series given below: I 4 4 4 4 4 4 3+ + 2.3.4 4.5.6*6.7.8 8.9. 10 10.11.12 12. 13. 14 Note denominators that are the product of three consecutive integers which increase with every new iteration

Step by Step Solution

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

Practical Database Programming With Visual C# .NET

Authors: Ying Bai

1st Edition

0470467274, 978-0470467275

More Books

Students also viewed these Databases questions

Question

Distinguish between accrual and cash-basis accounting.

Answered: 1 week ago

Question

Errors uncovered during work to make change, Echange.

Answered: 1 week ago