In [1]:
from pylab import *
from mycomet import comet
rcParams['animation.html'] = 'html5'
In [11]:
roots([1, 0, 0, 0, 4])
Out[11]:
array([-1.+1.j, -1.-1.j,  1.+1.j,  1.-1.j])
In [26]:
-exp(log(4) + 4*pi*1j)
Out[26]:
(-4+1.959434878635765e-15j)
In [27]:
-(exp(log(4)/4))
Out[27]:
-1.414213562373095
In [9]:
t = linspace(0, 2*pi, 200)
i = 1j
r = t
z = r*exp(i*t)
comet(real(z), imag(z))
Out[9]:
In [3]:
i = 1j
th = linspace(0, 2*2*pi)
z = 10*exp(i*th)
comet(real(z), imag(z))
Out[3]:
In [4]:
i = 1j
th = linspace(0, 2*2*pi)
z = th*exp(i*th)
comet(real(z), imag(z))
Out[4]:
In [5]:
i = 1j
th = linspace(0, 5*2*pi)
z = th*exp(i*th)
comet(real(z), imag(z))
Out[5]:
In [33]:
k = np.array(range(8))
k
Out[33]:
array([0, 1, 2, 3, 4, 5, 6, 7])
In [35]:
r = 1
th = pi/4*k
th
Out[35]:
array([0.        , 0.78539816, 1.57079633, 2.35619449, 3.14159265,
       3.92699082, 4.71238898, 5.49778714])
In [37]:
z = r*exp(i*th)
z
Out[37]:
array([ 1.00000000e+00+0.00000000e+00j,  7.07106781e-01+7.07106781e-01j,
        6.12323400e-17+1.00000000e+00j, -7.07106781e-01+7.07106781e-01j,
       -1.00000000e+00+1.22464680e-16j, -7.07106781e-01-7.07106781e-01j,
       -1.83697020e-16-1.00000000e+00j,  7.07106781e-01-7.07106781e-01j])
In [40]:
plot(real(z), imag(z), 'rx')
savefig('plot1.png')