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

import numpy as np import matplotlib.pyplot as plt def find_roots(y): z = np.diff(np.heaviside(y,0)) return np.argwhere(z!=0) x = np.arange(0.5,5.5,0.001) y = (x-1)*(x-2)*(x-3)*(x-4)*(x-5) y1 = np.diff(y)/np.diff(x) idx = find_roots(y1) plt.plot(x[idx],y[idx],'r.') plt.plot(x,y)
[<matplotlib.lines.Line2D at 0x7f306e8ea1d0>]
Image in a Jupyter notebook
import mathimport math 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,7*6.28,0.001) r = x/np.max(x) r = r/5 plt.plot(np.cos(x)*r + 0.4,np.sin(x)*r + 0.4,'darkorchid') t = np.arange(-1,1,0.0001) x = 0.5*np.sin(t)*np.cos(t)*np.log(abs(t)) - 0.6 y = 0.5*abs(t)**0.4 * np.cos(t) - 0.25 plt.plot(x1,y1,'x,y,'sienna') beta =beta*math.pi/ 315 beta = beta*math.pi/180 x1 = x*np.cos(beta) - y*np.sin(beta) + 1 + 1 y1 = x*np.sin(beta) + y*np.cos(beta) - 0.5 plt.plot(x1,y1,'violet')
[<matplotlib.lines.Line2D at 0x7f306cc1a750>]
Image in a Jupyter notebook