%% Example Of A Locally Conformal Mapping: w = 1/z, z ≠ 0 %% CSUMS Summer 2010 A.O. Hausknecht %% Written using OCTAVE function plotZInverse_CircularGrid() clf; %% Create A Plot Of The Circular Grid subplot (1, 2, 1) title ("Grid Of Truncated Sectors") hold on %% Draw filled of truncated sectors plotFilledSector(0*pi/4, 1, 1*pi/4, 2, [0.9 0.9 0.9]) plotFilledSector(1*pi/4, 1, 2*pi/4, 2, [1 0 0]) plotFilledSector(2*pi/4, 1, 3*pi/4, 2, [0 1 0]) plotFilledSector(3*pi/4, 1, 4*pi/4, 2, [0 0 1]) plotFilledSector(0*pi/4, 0.5, 1*pi/4, 1, [1 1 0]) plotFilledSector(1*pi/4, 0.5, 2*pi/4, 1, [0 1 1]) plotFilledSector(2*pi/4, 0.5, 3*pi/4, 1, [1 0 1]) plotFilledSector(3*pi/4, 0.5, 4*pi/4, 1, [0.5 0.5 1]) %% Plot the grid's circles t = linspace(0,2*pi, 50); for r = [0.5 2] plot( r*cos(t), r*sin(t),'b'); end plot( cos(t), sin(t),'k', 'linewidth', 3); %% Plot the grid's radial lines r = 0:.1:2; for theta = 0: pi/4.0: 2*pi plot( r*cos(theta), r*sin(theta), 'r') end %% Set the axes domain, range, and scaling. axis('equal') axis([-3 3 -3 3]) %% Plot Unit Tangents plotUnitTangents(2 , 'blue', 'yellow') plotUnitTangents((2+2i)/sqrt(2) , 'green', 'cyan') hold off %% Create A Plot The Image Of The Circular Grid subplot (1, 2, 2) title ("Image Of Grid Under 1/z") hold on %% Draw images of filled truncated sectors plotImageOfFilledSector(0*pi/4, 1, 1*pi/4, 2, [0.9 0.9 0.9]) plotImageOfFilledSector(1*pi/4, 1, 2*pi/4, 2, [1 0 0]) plotImageOfFilledSector(2*pi/4, 1, 3*pi/4, 2, [0 1 0]) plotImageOfFilledSector(3*pi/4, 1, 4*pi/4, 2, [0 0 1]) plotImageOfFilledSector(0*pi/4, 0.5, 1*pi/4, 1, [1 1 0]) plotImageOfFilledSector(1*pi/4, 0.5, 2*pi/4, 1, [0 1 1]) plotImageOfFilledSector(2*pi/4, 0.5, 3*pi/4, 1, [1 0 1]) plotImageOfFilledSector(3*pi/4, 0.5, 4*pi/4, 1, [0.5 0.5 1]) %% Plot images of the circles under w = 1/z t = linspace(0,2*pi, 50); for r = [0.5 2] plot(cos(t)/r, -sin(t)/r,'b'); end plot( cos(t), -sin(t),'k', 'linewidth', 3); %% Plot images of the radial lines under w = z^2 r = 0.5: .1: 2; for theta = 0: pi/4.0: 2*pi plot(r*cos(theta), r*sin(theta), 'r') end %% Set the axes domain, range, and scaling. axis('equal') axis([-3 3 -3 3]) %% Plot the images of the Unit Tangents plotImagesOfUnitTangents(2 , 'blue', 'yellow') plotImagesOfUnitTangents((2+2i)/sqrt(2) , 'green', 'cyaN') hold off end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% Helper functions used above function plotFilledSector(t0, r0, t1, r1, color) %% Fill a truncated sector %% 1. Generate points along the bottom edge %% which is part of a circle. t = linspace(t0, t1, 10); x1 = r0*cos(t); y1 = r0*sin(t); %% %% 2. Generate points along the top edge %% in revese order and generate the points t = fliplr (t); x2 = r1*cos(t); y2 = r1*sin(t); %% %% 3. Now collect all the points of the regions %% boundary together in counter-clockwise order! x = cat(2, x1, x2); y = cat(2, y1,y2); %% %% 4. Finally, fill the region fill (x, y, color) end function plotImageOfFilledSector(t0, r0, t1, r1, color) %% Fill the image of truncated sector %% 1. Generate points along the bottom edge %% which is part of a circle. t = linspace(t0, t1, 20); x1 = cos(t)/r0; y1 = -sin(t)/r0; %% %% 2. Generate points along the top edge %% in revese order. t = fliplr (t); x2 = cos(t)/r1; y2 = -sin(t)/r1; %% %% 3. Now collect all the points of the region's %% boundary together in counter-clockwise order! x = cat(2, x2, x1); y = cat(2, y2, y1); %% %% 4. Finally, fill the region with green fill (x, y, color) end function plotUnitTangents(z, color1, color2) %% Draw Unit Tangent vectors at z %% %% 1. Draw the radial tangent to at z. dz = z/abs(z); a = [real(z) real(z + dz)]; b = [imag(z) imag(z + dz)]; line(a, b, 'linewidth',3, 'color', color1); %% %% 2. Draw the tangent dz to the circle at z. %% Note: Use J(x+yi) = -y+xi to obtain perpindicular vector dz = -imag(dz) + real(dz)*i; a = [real(z) real(z + dz)]; b = [imag(z) imag(z + dz)]; line(a,b, 'linewidth',3, 'color', color2) end function plotImagesOfUnitTangents(z, color1, color2) %% Plot images of the Unit Tangent vectors at w = 1/z w = 1/z; %% 1. Use the derivative to plot the image of the radial tangent %% to the circle: Note: dw = -1/z^2*dz dz = z/abs(z); dw = -1/z^2*dz; a = [real(w) real(w+dw)]; b = [imag(w) imag(w+dw)]; line(a,b, 'linewidth', 3, 'color', color1); %% %% 2. Draw the tangent dz to the circle at z. %% Note: Use J(x+yi) = -y+xi to obtain perpindicular vector dz = -imag(dz) + real(dz)*i; dw = -1/z^2*dz; a = [real(w) real(w+dw)]; b = [imag(w) imag(w+dw)]; line(a,b, 'linewidth', 3, 'color', color2); end