Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function with the header: function [piEstimate, piError] = myForPi(nIterations) which uses a for-loop and the Archimedes method below to estimate the value of

Write a function with the header:

function [piEstimate, piError] = myForPi(nIterations)

which uses a for-loop and the Archimedes method below to estimate the value of pi (you must use this approach). 1. Let A = 1 and N = 6 2. Repeat the following nIterations times a. Replace N by 2N b. Replace A by [2 sqrt(4 A^2) ]^(1/2) c. Let L = NA/2 d. Let U = L/sqrt(1 A^2/2) e. Let piEstimate = (U + L)/2 f. Let piError = (U-L)/2 3. Return

image text in transcribed

Problem 1: (5 Points) Write a function with the header: function [p|Estimate, piError] myForPi(n1terations) = which uses a for-loop and the Archimedes method below to estimate the value of pi (yoU rt us iisoh) I. Let A = 1 and N 6 2. Repeat the following nlterations times a. Replace N by 2N b. Replace A by [2- sqrt(4- AA2) A(1/2) C. Let L = NA/2 d. Let UL/sqrt(1 -AA2/2) e. Let p-Estimate = (U + L)/2 f. Let pError=(U-L)/2 3. Return

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

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions

Question

Briefly summarize the elements of good radio commercials.

Answered: 1 week ago

Question

1. Describe the factors that lead to productive conflict

Answered: 1 week ago