Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

.4xH.Ht 2. One commonly reported infinite series for Tt is Unlike the continued fraction expansion above, this series approximation involves adding successive terms to a

image text in transcribed

.4xH.Ht 2. One commonly reported infinite series for Tt is Unlike the continued fraction expansion above, this series approximation involves adding successive terms to a running total, which converges on the exact value as each successive added term gets smaller and smaller. (This particular series converges VERY slowly.) a) Write an algorithm in pseudocode for this series (remember to multiply by 4 in order to get pi). Note that for k 1, 2,3, etc., (-1k*11,-1, +1, etc, and (2k-1)-1, 3, 5, etc. Create a function mypi to implement this series approximation. The function should have one scalar input argument Nterms that controls the number of terms used in the approximation, and one output argument piVec that is an array containing the estimate (running total) of the series after each term is added. In other words, use array indexing to add the next term in the series to piVeclk-1) in order to obtain piVec(k). Verify that your function works properly by comparing the estimate after each of the first few terms to a hand calculation. Paste the code and output on the answer sheet. In order to evaluate how the series converges toward pi, use the function (from the command line or a script) to create a plot of the approximation as a function of the term number, for the first 100 terms. Paste the graph on the answer sheet. b) c)

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

Students also viewed these Databases questions