### 19.4.3 Graphing the area under a curve

The plotarea or areaplot command draws the area below a graph.

- plotarea takes two mandatory arguments and two optional arguments:
  - expr, an expression representing the function to graph.
  - var=a..b, the variable and the range of values.
  - Optionally, n.
  - Optionally, method, a method to approximate the region under the graph, which can be one of: trapezoid, rectangle_left, rectangle_right or middle_point.
- plotarea(expr,var=a..b) draws and shades the area between the graph of expr and the y-axis for a < var < b.
- plotarea(expr,var=a..b ⟨,n,method ⟩) draws and shades the region used by the numeric approximation method method for area between the graph of expr and the y-axis for a < var < b, when [a,b] is cut into n equal parts, along with the graph in red.

#### Examples

plotarea(sin(x),x=0..2*pi)

plotarea(x^2,x=0..1,5,trapezoid)

plotarea((x^2,x=0..1,5,middle_point)