# parametric plots of unimodular polynomials in orange, L2-norm in green
# graphs of distance from L2-norm in red; if this graph has a low maximum, the polynomial is flat
t=var('t')
x=1 + cos(2*pi*t) + cos(2*pi*(2*t))
y=sin(2*pi*t) + sin(2*pi*(2*t))
P = parametric_plot( (x(t),y(t)), 0, 1, rgbcolor=hue(0.1) )
d = sqrt(3)
Q = parametric_plot( (d*cos(2*pi*t),d*sin(2*pi*t)), 0, 1, rgbcolor=hue(0.5) )
W=P+Q
r = abs(sqrt(x(t)^2 + y(t)^2) - d)
R = plot(r(t), 0, 1, rgbcolor=hue(0.0))
R.xmin(0)
R.ymin(0)
R.ymax(2)
x2=1 + cos(2*pi*t) + cos(2*pi*(2*t+1/2))
y2=sin(2*pi*t) + sin(2*pi*(2*t+1/2))
P2 = parametric_plot( (x2(t),y2(t)), 0, 1, rgbcolor=hue(0.1) )
W2=P2+Q
W2.set_aspect_ratio(1)
r2 = abs(sqrt(x2(t)^2 + y2(t)^2) - d)
R2 = plot(r2(t), 0, 1, rgbcolor=hue(0.0))
R2.xmin(0)
R2.ymin(0)
R2.ymax(2)
G = graphics_array( [ ( W, W2 ),( R, R2 ) ] );
show(W2)
show(G, aspect_ratio=1)