An example of 
Sample Calculus 
in action
For an ordered sample of t values from 0 to 2p corresponding values for 
   x = 2 + sin   and    y = 10 + t (2p - t) cos  
are computed. From them we compute the average of successive pairs of y values, yr = mids(y), and the differences, d(x), between successive x values.  The sequence of partial sums,  A = S(yr * d(x)), gives the cumulative area of the trapezoids drawn between successive (x,y) points with verticals to the x axis.  Both y and A are plotted against x. 

As the heart-shaped curve is traced out by the black line joining (x,y) points, the signed areas of the trapezoids below the curve are accumulated and traced by the red line joining (x,A) points. The last A value gives the trapezoidal approximation to the line integral, S y dx, for the area of the heart shape.

 
Click here to return to Introduction
 Linked pages provide the required function definitions for various computing environments.