Matlab Chapter II - Chapter 2 Limits, Error, Approximation...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Chapter 2 Limits, Error, Approximation 2.1 Summation Pi Via Tiling 2.1 Keeping an Eye on Convergence Pi Via Polygons 2.3 Rational Approximation* 22/7-ths and Other Fractions The constant is a neverending decimal: 3.14159265358979323846264338327950288419716939937510582097494459230781 64062862089986280348253421170679821480865132823066470938446095505822 31725359408128481117450284102701938521105559644622948954930381964428 81097566593344612847564823378678316527120190914564856692346034861045 43266482133936072602491412737245870066063155881748815209209628292540... In this chapter we compute some more modest approximations. Our f rst approach is to cover the circle x 2 + y 2 = n 2 with 1-by-1 tiles. If N is the number of tiles that are completely within the circle, then from the approximation n 2 N we conclude that N/n 2 . In this case the problem of estimating reduces to a count- the-tiles problem. We will see that the error goes to zero as n . Another approach is to approximate the unit circle with a polygon and regard the polygon area as an approximation to . For a given n , a good approximating polygon is the regular n-gon whose vertices are on the unit circle. This area will underestimate . If we use the regular n-gon whose edges are tangent to the unit circle, then its area will be an overestimate of . In either case the error goes to zero as n . Finally, we look to see how close we can get to with a fraction p/q subject to the constraint that both p and q are less than some prescribed value M . The quotient 22/7 is a well known approximation in this regard. These -approximation examples point to how we can cope with in f nities when we compute. There isnt enough time to compute a neverending decimal. And no computer has enough memory to store exactly. Nevertheless, we are able to compensate for these shortfalls through intelligent approximation. 1 Example 2.1 Pi Via Tiling % Script Eg2_1 % Estimate Pi by tiling a circle. % Enter the circle radius... clc n = input(Enter n:) % Tile just the first quadrant, then multiply by four. N1 = 0; for k = 1:n-1 % The number of uncut tiles in row k... s = floor(sqrt(n^2 - k^2)); N1 = N1 + s; end % Estimate pi... rho_n = 4*N1/n^2; clc disp(sprintf(n = %1d,n)) disp(sprintf(rho_n = %12.8f,rho_n)) disp(sprintf(Error = %12.8f,abs(pi-rho_n))) Sample Output: h = 0.00000100 MyPi = 3.14158865 Error = 0.00000400 2 2.1. Summation 3 2.1 Summation Problem Suppose n is a positive integer and we trace the circle x 2 + y 2 = n 2 onto graph paper. For the case n = 10, Figure 2.1 is what we would obtain with the help of some scissors. Note that the area of the disk is n 2 and that each uncut tile has unit area. If there are Figure 2.1: Tiling the Circle x 2 + y 2 = n 2 , ( n = 10) N uncut tiles, then we conclude that n 2 N since the uncut tiles almost cover the disk....
View Full Document

This note was uploaded on 02/23/2008 for the course CS 100 taught by Professor Fan/vanloan during the Spring '07 term at Cornell University (Engineering School).

Page1 / 14

Matlab Chapter II - Chapter 2 Limits, Error, Approximation...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online