This preview shows page 1. Sign up to view the full content.
Unformatted text preview: N_cut = 0; % number of cut tiles xprev = n; % x-value (bottom of 1st row) x % Iterate through each row % for k = 1:n xk = sqrt(n^2-k^2); % x-value @ y=k (top of k'th row) s = floor(xk); % # uncut tiles in k'th row c = ceil(xprev)-s; % # cut tiles in k'th row N_uncut = N_uncut + s; N_cut = N_cut + c; xprev = xk; end e % Estimate pi. .. % piApproximation = (4*(N_uncut + N_cut*f))/(n^2); p...
View Full Document
This note was uploaded on 09/12/2009 for the course CS 100 taught by Professor Fan/vanloan during the Fall '07 term at Cornell.
- Fall '07