Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import matplotlib as mpl
- from matplotlib import pyplot as plt
- import numpy as np
- plt.rcParams.update({
- 'text.usetex': True,
- 'text.latex.preamble': r'\usepackage{amsfonts}'
- })
- N_ts = 2_000_000
- t_1s = [np.exp(ang * 1j) for ang in np.random.uniform(0, 2*np.pi, N_ts)]
- t_2s = [np.exp(ang * 1j) for ang in np.random.uniform(0, 2*np.pi, N_ts)]
- ts = np.column_stack([t_1s, t_2s])
- pts = np.zeros((4 * len(ts),)).astype(complex)
- for i in range(len(ts)):
- t_1 = ts[i][0]
- t_2 = ts[i][1]
- # 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
- poly = np.poly1d([
- 8.0, # x^4
- 0.0, # x^3
- t_2**4 - 1.0j * t_2**2 - 1.0, # x^2
- 0.0, # x
- t_1**4 + t_1**2 - 1.0j * t_1 - 1.0 #
- ])
- roots = poly.roots
- pts[4*i:4*i+4] = roots
- fig,ax = plt.subplots(figsize=(30,30))
- fig.set_facecolor("#f4f0e7")
- fig.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=None, hspace=None)
- for spine in ['top', 'right','left','bottom']:
- ax.spines[spine].set_visible(False)
- ax.scatter(
- x=pts.real,
- y=pts.imag,
- c="#262626",
- s=0.15*np.abs(pts),
- linewidths=1e-6)
- ax.set_axis_off()
- ax.set_aspect('equal')
- 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)
- plt.savefig('pretty_shape.png')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement