Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib.pyplot as plt
- import numpy as np
- f = np.linspace(0, np.pi *2,num= 100)
- x = np.sin(f)
- y = np.cos(f)
- z = np.zeros(100) # approximation of f from coordinates
- scale2 = np.zeros(100)
- for i in range(100):
- yy = np.abs(y[i])
- xx = np.abs(x[i])
- if xx > yy:
- temp = yy/xx
- z[i] = -(0.97239411 + -0.19194795 * temp * temp) * temp + np.pi/2
- else:
- temp = xx/yy
- z[i] = (0.97239411 + -0.19194795 * temp * temp) * temp
- w = z[i]
- ww = w*w
- sinw = w * (1 - ww *(1 / 6 - ww/120 ))
- sin3w = 3*sinw - 4* sinw* sinw* sinw
- scale2[i] = 1 - np.abs(sin3w) * (1-np.cos( np.pi / 6))
- #scale2 = 1 - np.abs(np.sin(nofpoints/2*z))* (1-np.cos( np.pi / nofpoints))
- plt.figure(figsize=(10,10))
- f2 = np.linspace(0, np.pi *2,num= 7)
- plt.plot(np.sin(f2), np.cos(f2))
- plt.plot(np.multiply(x, scale2), np.multiply(y, scale2))
- plt.plot(np.multiply(x, scale2)*1.25, np.multiply(y, scale2)*1.25)
- plt.xlim([-1.5, 1.5])
- plt.ylim([-1.5, 1.5])
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement