Sliding on the slope

If we want to measure how a function changes over time, the first intuitive step would be to take the value of a function and then measure it at the subsequent point. Subtracting the second value from the first would give us an idea of how much the function changes over time:

    import matplotlib.pyplot as plt     import numpy as np      %matplotlib inline      def quadratic(var):         return 2* pow(var,2)     x=np.arange(0,.5,.1)     plt.plot(x,quadratic(x))     plt.plot([1,4], [quadratic(1), quadratic(4)],  linewidth=2.0)     plt.plot([1,4], [quadratic(1), quadratic(1)],  linewidth=3.0,     label="Change in x")     plt.plot([4,4], [quadratic(1), quadratic(4)],  linewidth=3.0,     label="Change in y")     plt.legend()     plt.plot (x, 10*x -8 )     plt.plot() 

In the ...

Get Machine Learning for Developers now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.