from sage.plot.colors import rgbcolor
h = sgn(x)/2+sgn(1/2-x)-sgn(1-x)/2
P = point([(0,0)], size=0)
f = 0
N = 1
for l in srange(1,N):
f += 2^(-l)*h(x = x/(2^l))
P += plot(f,x,-0.001,33, color = rgbcolor([l/N,0,0]), thickness = 3 )
thi = 4
f = 2
def mcirg(a,b):
P = circle( (a,b),0.035*f, fill=True, color='white', zorder= 190 )
P += circle( (a,b),0.035*f, fill=False, thickness=2, zorder= 200 )
return P
def mcirbg(a,b):
P = circle( (a,b),0.035*f, fill=True, zorder= 190 )
return P
##### HAAR
b = 3
P = line( [(-b,0), (0,0)], thickness=thi)
P += line( [(0,1), (1/2,1)], thickness=thi)
P += line( [(1/2,-1), (1,-1)], thickness=thi)
P += line( [(1,0),(b,0)], thickness=thi)
P += mcirg(0,0)
P += mcirbg(0,1)
P += mcirg(1/2,1)
P += mcirbg(1/2,-1)
P += mcirg(1,-1)
P += mcirbg(1,0)
P.set_aspect_ratio(1)
#P.axes(False)
P.fontsize(25)
P.save('./images/haar0.png')
P = point([(0,0)], size=0)
f = -h/4
N = 5
for l in srange(1,N):
# P = plot(f,x,-0.001,10, color = rgbcolor([l/N,0,0]), thickness = 3 )
P = plot(f,x,-0.5,5, thickness = 3 , plot_points = 500)
P.fontsize(25)
#P.set_aspect_ratio(1)
#P.axes(False)
P.save('./images/haar'+str(l)+'.png')
f += 2^(-l-1)*h(x = x/(2^l))
for k in srange(2^l):
f += -2^(-l-2)*h(x = 2^l*x-k)
|