oundary coordinates: A=12|(x1y2+x2y3+⋯+xn−1yn+xny1)−(y1x2+y2x3+⋯+yn−1xn+ynx1)|.(17) Write a function polygon_area(x, y) that takes two coordinate lists with the vertices as arguments and returns the area. Test the function on a triangle, a quadrilateral, and a pentagon where you can calculate the area by alternative methods for comparison. Hint.
One of the most important mathematical problems through all times has been to find the area of a polygon. For example, real estate areas often had the shape of polygons, and the tax was proportional to the area. Suppose we have some polygon with vertices ("corners") specified by the coordinates (x1,y1), (x2,y2), …, (xn,yn), numbered either in a clockwise or counter-clockwise fashion around the polygon. The area A of the polygon can amazingly be computed by just knowing the boundary coordinates:
Write a function polygon_area(x, y) that takes two coordinate lists with the vertices as arguments and returns the area.
Test the function on a triangle, a quadrilateral, and a pentagon where you can calculate the area by alternative methods for comparison.
Hint.
Since Python lists and arrays has 0 as their first index, it is wise to rewrite the mathematical formula in terms of vertex coordinates numbered as x0,x1,…,xn−1 and y0,y1,…,yn−1 before you start
![One of the most important mathematical problems through all times has been to find the area of a polygon. For example, real estate areas often had the shape
of polygons, and the tax was proportional to the area. Suppose we have some polygon with vertices ("corners") specified by the coordinates (x1, y1), (x2, y2),
..., (Xn, Yn), numbered either in a clockwise or counter clockwise fashion around the polygon. The area A of the polygon can amazingly be computed by just
•••
knowing the boundary coordinates:
1
A =
(x1y2 + x2y3 + .… + Xp-1Yn + x„y1)–
2
...
(y1x2 + y2X3 +
+ yn-1Xn + YnX1)| .
(17)
...
Write a function polygon_area(x, y) that takes two coordinate lists with the vertices as arguments and returns the area.
Test the function on a triangle, a quadrilateral, and a pentagon where you can calculate the area by alternative methods for comparison.
IG Hint.
Since Python lists and arrays has 0 as their first index, it is wise to rewrite the mathematical formula in terms of vertex coordinates numbered as
X0, X1, ... , Xn-1 and yo, y1, ... , Yn-1 before you start programming.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F30ffb29f-3d04-41fa-a20e-5ec8fdc0cf31%2Fe4deae88-f887-47f2-9ba3-0f51eeb78d3c%2Fspufdy_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)