Calculating Slopes

There are two common approaches to calculating slopes:

  • Computing the average slope over a number of points (regression)
  • Computing the slope from two points (often called differences)

Forward Difference

To calculate the slope at a point, we use that point and the point after it (forward in time).

Backward Difference

To estimate the slope at a point, we use that point and the point before it (backward in time).

Central Difference

To estimate the slope at a point, we don’t use the point itself, but the point before and after it in time.

By pythonnumericalmethods.berkeley.edu
By Kakitc - Own work, CC BY-SA 4.0

Calculating Areas

Reimann Sum

This is the mathematical term for breaking up an area into areas. We will start with rectangles.

Left Reimann sum

Right Reimann sum

Trapeziodal Riemann sum

Computing Area

The area of a rectangle is the height times the width. The height we can get from each sample in our data set. To get the width, we find the difference between the samples on the x-axis.

This can sometimes involve cumbersome date and time arithmetic.