CoCalc Public FilesSL2R.sagews
Author: Kyle Ormsby
Views : 78
Description: Animations of the action of SL_2(R) on the upper half plane. See http://people.reed.edu/~ormsbyk/341/SL2R.html for details.
Compute Environment: Ubuntu 18.04 (Deprecated)
#hyperbolic transformation (translation)
#a(t) is the prototypical hyperbolic family with fixed points 0 and infinity
def a(t):
return Matrix([[exp(t),0],[0,exp(-t)]]);
#conjugate a(t) to produce a family with fixed points 0 and 1
def conj_a(t):
c = Matrix([[1,0],[1,1]]);
return c*a(t)*(c.inverse());
#act on a complex number by a matrix as a linear fractional transformation
def LFT(A,z):
a = A[0,0]; b = A[0,1]; c = A[1,0]; d = A[1,1];
return (a*z+b)/(c*z+d);
#draw how the circle of radius r centered at 0 is transformed by conj_a(t)
var('s');
def circ_a(t,r):
complexval = LFT(conj_a(t),r*exp(i*s));
return parametric_plot((complexval.real(),complexval.imag()),(s,0,pi));
#animate the transformed circles by letting t range from 0 to 3
conj_a_circs = [(circ_a(t,1/32)+circ_a(t,1/16)+circ_a(t,3/32)+circ_a(t,1/8)) for t in srange(0,3,0.1,include_endpoint=True)];
hyperbolic = animate(conj_a_circs,xmin=-1,xmax=2,ymin=0,ymax=2);
hyperbolic.show();
#hyperbolic.save('hyperbolic.gif');

s
#parabolic transformation (limit rotation)
#n(t) is the prototypical parabolic family with fixed point 0
def n(t):
return Matrix([[1,0],[t,1]]);
#draw how some geodesics with endpoint at 0 are transformed by n(t)
def circ_n(t,r):
complexval = LFT(n(t),r*exp(i*s)-r);
return parametric_plot((complexval.real(),complexval.imag()),(s,0,pi));
#animate the transformed geodesics by letting t range from 0 to 12
n_circs = [(circ_n(t,1/16)+circ_n(t,3/32)+circ_n(t,1/8)) for t in srange(0,12,0.25,include_endpoint=True)];
parabolic = animate(n_circs,xmin=-1,xmax=1,ymin=0,ymax=2);
parabolic.show();
#parabolic.save('parabolic.gif')

#elliptic transformation (rotation)
#k(t) is the prototypical elliptic family with fixed point i
def k(t):
return Matrix([[cos(t),-sin(t)],[sin(t),cos(t)]]);
#draw how some geodesics passing through i are transformed by k(t)
#theta is the angle between the line from the center c to i and the real axis
def circ_k(t,theta):
c = -cot(theta);
r = csc(theta);
complexval = LFT(k(t),r*exp(i*s)-c);
return parametric_plot((complexval.real(),complexval.imag()),(s,0,pi));
#animate the the transformed geodesics by letting t range from 0 to 2*pi
k_circs = [(circ_k(t,pi/6)+circ_k(t,pi/4)+circ_k(t,pi/3)) for t in srange(0,2*pi,pi/41,include_endpoint=True)];
elliptic = animate(k_circs,xmin=-3,xmax=3,ymin=0,ymax=3);
elliptic.show();
#elliptic.save('elliptic.gif');