# szego

``````

In [2]:

%matplotlib inline
import sys; sys.path.append('..')
import matplotlib.pyplot as plt
import numpy as np

from conformalmapping import *

``````
``````

In [3]:

G = Splinep.from_complex_list([
0.2398 + 0.6023j, 0.3567 + 1.0819j, 0.2632 + 1.5965j,
-0.5205 + 1.7485j, -1.0585 + 1.1170j, -1.0702 + 0.5088j,
-0.5906 + 0.0994j, -0.7778 - 0.4269j, -1.2924 - 0.6140j,
-1.4561 - 1.2456j, -0.5439 - 1.3509j, 0.2515 - 1.0702j,
0.3099 - 0.6023j, 0.7427 - 0.5906j, 1.1053 - 0.1813j,
1.2807 + 0.3567j
])

``````
``````

In [5]:

sm = SzMap(G, 0)
sm.plot()

``````
``````

Starting bisection ...
Bisection finished in 14 steps
Starting Newton iteration ...

Newton iteration finished in 5 steps...

label: 4/256 points with |f| > eps, max|f| = 0.0000

``````
``````

In [3]:

S = Szego(G, 0)

``````
``````

In [4]:

t = np.arange(20)/20.

plt.subplot(1,2,1)
G.plot()
zs = G(t)
plt.plot(zs.real, zs.imag, 'ro')
plt.gca().set_aspect('equal')
plt.gca().axis(G.plotbox())

plt.subplot(1,2,2)
c = Circle(0, 1)
c.plot()
zs = np.exp(1.0j * S.theta(t))
plt.plot(zs.real, zs.imag, 'ro')
plt.gca().set_aspect('equal')
plt.gca().axis(c.plotbox())

``````
``````

Out[4]:

array([-1.19999038,  1.19999913, -1.20001012,  1.19997938])

``````
``````

In [5]:

plt.subplot(1,2,1)
Circle(0, 1).plot()
zs = np.exp(2j*np.pi*t)
plt.plot(zs.real, zs.imag, 'rd')

plt.subplot(1,2,2)
val = G(S.invtheta(2*np.pi*t))
G.plot()
plt.plot(val.real, val.imag, 'rd')

``````
``````

Starting bisection ...
Bisection finished in 14 steps
Starting Newton iteration ...

Newton iteration finished in 3 steps...

label: 0/20 points wit |f| > eps, max|f| = 0.0000

Out[5]:

[<matplotlib.lines.Line2D at 0x108edce50>]

``````
``````

In [5]:

np.set_printoptions(precision=4, suppress=True, linewidth=15)
N = 512
th= 2*np.pi*np.arange(N)/float(N)
t = S.invtheta(th)
w = G(t)
c = np.fft.fft(w)/float(N)
f = lambda z : np.polyval(helpers.flipud(c),z)

``````
``````

Starting bisection ...
Bisection finished in 14 steps
Starting Newton iteration ...

Newton iteration finished in 5 steps...

label: 6/512 points wit |f| > eps, max|f| = 0.0000

``````
``````

In [13]:

gd = unitdisk().grid()
lst = []
for curve in gd.curves:
newcurve = f(curve)
lst.append(newcurve)
gc = GridCurves(lst)
gc.plot()
G.plot()
plt.gca().set_aspect('equal')
plt.gca().axis(G.plotbox())
ax = plt.gca()
ax.set_xticks([])
ax.set_yticks([])

``````
``````

Out[13]:

[]

``````
``````

In [ ]:

``````