Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
| Download
Views: 1735
Image: ubuntu1804
Kernel: Python 2 (system-wide)

import numpy as np from matplotlib import pyplot as plt x = np.linspace(0,2,60) y = x**3 - 9*x**2 -23 * x -15 plt.plot(x,y,'ro') y1 = np.diff(y)/np.diff(x) plt.plot(x[:-1],y1,'bo')
[<matplotlib.lines.Line2D at 0x7fd9039c2810>]
Image in a Jupyter notebook
x = np.linspace(0,6.28,100) y = np.sin(x)**2 plt.plot(x,y,'ro') y1 = np.diff(y)/np.diff(x) #np.diff -> [x] plt.plot(x[:-1],y1,'bo')
[<matplotlib.lines.Line2D at 0x7fd9019118d0>]
Image in a Jupyter notebook
x = np.linspace(0,6.28,1000) plt.plot(np.sin(x),np.cos(x)) plt.plot(np.sin(x)*0.2-0.4,np.cos(x)*0.2 + 0.4,'g') plt.plot(np.sin(x)*0.2+0.4,np.cos(x)*0.2 + 0.4,'orange') plt.plot(-np.cos(x/2)*0.2,-np.sin(x/2)*0.2,'r') x = np.arange(0,5*6.28,0.01) r = x/np.max(x) r = r/5 plt.plot(np.cos(x)*r + 0.4,np.sin(x)*r + 0.4,'darkorchid')
[<matplotlib.lines.Line2D at 0x7fd8fae33290>]
Image in a Jupyter notebook