Exercise

Slope and Rates-of-Change

In this exercise, you will model the motion of a car driving (roughly) constant velocity by computing the average velocity over the entire trip. The linear relationship modeled is between the time elapsed and the distance traveled.

In this case, the model parameter a1, or slope, is approximated or "estimated", as the mean velocity, or put another way, the "rate-of-change" of the distance ("rise") divided by the time ("run").

Instructions

100 XP
  • Compute the the point-to-point differences of both the times and distances using numpy.diff().
  • Compute an array of velocities as the ratio of the diff_distance divided by diff_times.
  • Compute the average and range of velocity values, using numpy methods mean, max, min.
  • Plot the array of velocities to visualize the average and spread of the values.