Advertisement
iSach

Untitled

Dec 6th, 2023
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. import matplotlib as mpl
  2. from matplotlib import pyplot as plt
  3. import numpy as np
  4.  
  5. plt.rcParams.update({
  6. 'text.usetex': True,
  7. 'text.latex.preamble': r'\usepackage{amsfonts}'
  8. })
  9.  
  10. N_ts = 2_000_000
  11. t_1s = [np.exp(ang * 1j) for ang in np.random.uniform(0, 2*np.pi, N_ts)]
  12. t_2s = [np.exp(ang * 1j) for ang in np.random.uniform(0, 2*np.pi, N_ts)]
  13. ts = np.column_stack([t_1s, t_2s])
  14.  
  15. pts = np.zeros((4 * len(ts),)).astype(complex)
  16. for i in range(len(ts)):
  17. t_1 = ts[i][0]
  18. t_2 = ts[i][1]
  19. # 8.0x^4+(1.0t_2^4-1.0it_2^2-1.0)x^2+1.0t_1^4+1.0t_1^2-1.0it_1-1.0
  20. poly = np.poly1d([
  21. 8.0, # x^4
  22. 0.0, # x^3
  23. t_2**4 - 1.0j * t_2**2 - 1.0, # x^2
  24. 0.0, # x
  25. t_1**4 + t_1**2 - 1.0j * t_1 - 1.0 #
  26. ])
  27. roots = poly.roots
  28. pts[4*i:4*i+4] = roots
  29.  
  30.  
  31. fig,ax = plt.subplots(figsize=(30,30))
  32. fig.set_facecolor("#f4f0e7")
  33. fig.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=None, hspace=None)
  34. for spine in ['top', 'right','left','bottom']:
  35. ax.spines[spine].set_visible(False)
  36. ax.scatter(
  37. x=pts.real,
  38. y=pts.imag,
  39. c="#262626",
  40. s=0.15*np.abs(pts),
  41. linewidths=1e-6)
  42. ax.set_axis_off()
  43. ax.set_aspect('equal')
  44. ax.set_title('$8.0x^4+(1.0t_2^4-1.0it_2^2-1.0)x^2+1.0t_1^4+1.0t_1^2-1.0it_1-1.0$ \n' + r'$t_1,t_2 \in \mathbb{C}, \ \ \ |t_1|=|t_2|=1$', fontsize=50)
  45.  
  46. plt.savefig('pretty_shape.png')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement