Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.88 KB | None | 0 0
  1. from sage.plot.circle import Circle
  2. @interact
  3. def myplot(f=0,xmin = -1, xwidth = 1):
  4.     xman = xmin + xwidth
  5.     p1 = plot(f,(xmin,xman),thickness = 1.5)
  6.     roots = solve(f,x)
  7.     show('Корни уравнения:', roots)
  8.     for i in range(len(roots)):
  9.         roots[i] = roots[i].rhs()
  10.     circles = [j for j in range(len(roots))]
  11.     for i in range(len(circles)):
  12.         circles[i] = circle((roots[i],0),0.2)
  13.         p1+=circles[i]
  14.     p1 += plot(diff(f,x),(xmin,xman),thickness=0.6,color = 'green')
  15.     diffRoots = solve(diff(f),x)
  16.     show('Точки экстремума: ', diffRoots)
  17.     for i in range(len(diffRoots)):
  18.         diffRoots[i] = diffRoots[i].rhs()
  19.     diffCircles = [j for j in range(len(diffRoots))]
  20.     for i in range(len(diffCircles)):
  21.         diffCircles[i] = circle(((diffRoots[i]),0), 0.2,color = 'green')
  22.         p1+=diffCircles[i]
  23.     show(p1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement