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 x = np.arange(-12,12,0.001) y = x**3 - 9*(x**2) -23 * x -15 def find_roots(y): z = np.diff(np.heaviside(y,0)) return np.argwhere(z!=0) print('the roots of the fuction are:',x[find_roots(y)]) plt.plot(x,y)
('the roots of the fuction are:', array([[11.177]]))
[<matplotlib.lines.Line2D at 0x7f53aa382210>]
Image in a Jupyter notebook
x = np.arange(0,10,0.001) y = x**5 -25*x**4 + 230*x**3 -950*x**2+1689*x-945 plt.plot(x,y) print('the roots of the fuction are:',np.round(x[find_roots(y)])) x = np.round(x[find_roots(y)]) y = np.zeros(np.shape(x)[0]) plt.plot(x,y,'r.')
('the roots of the fuction are:', array([[1.], [3.], [5.], [7.], [9.]]))
[<matplotlib.lines.Line2D at 0x7f53aa35d810>]
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,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(x,y,'sienna')
[<matplotlib.lines.Line2D at 0x7f53a12d8990>]
Image in a Jupyter notebook