Question: Note : This is using Python The value of n equals the circumference of a circle with radius 1/2. Suppose we approximate the circumference by
Note : This is using Python
The value of n equals the circumference of a circle with radius 1/2. Suppose we approximate the circumference by a polygon through n + 1 points on the circle. The length of this polygon can be found using the pathlength function from the previous exercise. Compute n + 1 points (x_i, y_i) along a circle with radius 1/2 according to the formulae x_i = 1/2 cos(2 pi i) y_i = 1/2 sin(2 pi i) i = 0, ..., n. Write a function circle_pts(n) which accepts a number of sides n and returns a pair of lists (as a tuple) containing the x and y coordinates of the approximating polygon. You will need to include your working pathlength function from the previous exercise. Write a function approx_pi(n) for approximating pi by the path length L resulting from the pairs of coordinate lists returned by circle_pts(n). Your answer should include three functions: pathlength, circle_pts, and approx_pi. (This assignment is based on Langtangen, Exercise 3.18.) The value of n equals the circumference of a circle with radius 1/2. Suppose we approximate the circumference by a polygon through n + 1 points on the circle. The length of this polygon can be found using the pathlength function from the previous exercise. Compute n + 1 points (x_i, y_i) along a circle with radius 1/2 according to the formulae x_i = 1/2 cos(2 pi i) y_i = 1/2 sin(2 pi i) i = 0, ..., n. Write a function circle_pts(n) which accepts a number of sides n and returns a pair of lists (as a tuple) containing the x and y coordinates of the approximating polygon. You will need to include your working pathlength function from the previous exercise. Write a function approx_pi(n) for approximating pi by the path length L resulting from the pairs of coordinate lists returned by circle_pts(n). Your answer should include three functions: pathlength, circle_pts, and approx_pi. (This assignment is based on Langtangen, Exercise 3.18.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
