Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- from math import sin,cos
- func = lambda phi:(1+sin(phi))*(1+0.9*cos(8*phi))*(1+0.1*cos(24*phi))
- class Cannabis(object):
- def __init__(self,func):
- "Инициализация конопли. Ее функция уже определена"
- self.coord = []
- self.x = []
- self.y = []
- phi = 0
- while phi<360:
- r = func(phi)
- crt = (phi,r)
- self.coord.append(crt)
- phi+=0.01
- for n,m in self.coord:
- xx = m * cos(n)
- yy = m * sin(n)
- self.x.append(xx)
- self.y.append(yy)
- def graph(self):
- plt.plot(self.x,self.y,'g--')
- plt.show()
- o = Cannabis(func)
- o.graph()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement