Computing the area under a curve

### 18.4.2 Computing the area under a curve

The area command approximates the area under a graph.

- area takes four arguments:
  - expr, an expression f(x).
  - var=a..b, the variable with a range.
  - n, a positive integer.
  - method, the approximation method to use, which can be one of:
    - trapezoid
    - left_rectangle
    - right_rectangle
    - middle_point
    - simpson
    - rombergt (Romberg with the trapezoid method)
    - rombergm (Romberg with the midpoint method)
    - gauss15 (The 15 point Gaussian quadrature)
- area(expr,var=a..b,n,method) returns an approximation to the area under the graph over the given interval, using the specified method with n subdivisions (or 2n subdivisions for rombergt, rombergm and gauss15).

#### Examples

area(x^2,x=0..1,8,trapezoid)

0.3359375 |  |  |  |  |  |  |  |  |  |

area(x^2,x=0..1,8,rombergm)

0.333333333333 |  |  |  |  |  |  |  |  |  |

area(x^2,x=0..1,3,gauss15)

0.333333333333 |  |  |  |  |  |  |  |  |  |

area(x^2,x=0..1)

1
3