Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function with the header function [piEstimate, piError] = myForPi (n!terations) which uses a forloop and the Archimedes method below to estimate the value

image text in transcribed
Write a function with the header function [piEstimate, piError] = myForPi (n!terations) which uses a forloop and the Archimedes method below to estimate the value of pi (you must use this approach). I. Let A = 1 and N=6 2. Repeat the following niterations times a. Replace N by 2N b. Replace A by [2-sart[4-AA2} ] 1 /2) C. Let L NA/2 d. Let U = L/sqrt(1-A^2/2) e. Let pEstimate = (U + L)/2 f. Let piError=U-L)/2 3. Return Test Functions >> [piEst, piErr] = myForPi (2) 3.160015969288298 piErr 0.027387356007061 >> [piEst, piErr] = myForPi (4) piEst 3.142715953186386 piErr = 0.001684002295856 >> [piEst, piErr] = myForPi (10) 3.141592927281175

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

Objects And Databases International Symposium Sophia Antipolis France June 13 2000 Revised Papers Lncs 1944

Authors: Klaus R. Dittrich ,Giovanna Guerrini ,Isabella Merlo ,Marta Oliva ,M. Elena Rodriguez

2001st Edition

3540416641, 978-3540416647

More Books

Students also viewed these Databases questions