Area function

Syntax: a = AREA(x,y)

The AREA function calculates the area enclosed in the polygon specified by the vertex coordinates given in the vector arguments x and y. Both vector arguments must be of the same length. The polygon need not be closed, that is, the last point will be assumed to connect to the first point.

Example

The following code produces the picture below.

 GENERATE THETA 0 .25 360
 R[1:LEN(THETA)] = 1
 SET AUTOSCALE COMMENSURATE
 GRAPH R*COSD(THETA) R*SIND(THETA)
 PIC = AREA(R*COSD(THETA),R*SIND(THETA))
 SET TEXTALIGN 2
 SET %XTEXTLOCATION 50
 SET %YTEXTLOCATION 90
 SET TEXTINTERACTIVE 0
 TEXT 'Calculated  = '//RCHAR(PIC)//', acos(-1) = '//RCHAR(ACOS(-1))