%MY_CPLXDEMO Maps of functions of a complex variable.

%   Copyright (c) 1984-98 by The MathWorks, Inc.
%   $Revision: 5.3 $  $Date: 1997/11/21 23:25:24 $
% RCS: Modified for our use Oct. 10, 2000


disp(' ')
disp(' ')
disp('Functions of a complex variable, f(z).')
disp('The domain is the unit disc, displayed in polar coordinates.')
disp('The height of the surface is the real part, real(f(z)).')
disp('The color of the surface is the imaginary part, imag(f(z)).')
disp('The color map varies from blue to red (jet color model).')
disp('There is a pause after each function; hit return to continue.')
disp(' ')

clf reset
colormap(jet)
% colormap(hsv(64))
z = my_cplxgrid(30);

my_cplxmap(z,z)
title('z')
disp('f(z) = z.')
disp(' '), pause

disp('f(z) = z^3.  Three maxima at the cube roots of 1.')
my_cplxmap(z,z.^3)
title('z^3')
disp(' '), pause

disp('f(z) = (z^4-1)^(1/4).  Four zeros at the fourth roots of 1.')
z1=1.5*z;
my_cplxmap(z1,(z1.^4-1).^(1/4));
title('(z^4-1)^(1/4)')
disp(' '), pause

disp('f(z) = log(z), the Principal Branch of Log.')
my_cplxmap(z,log(z));view(2)
title('Log(z)')
disp('Radial height given by ln(r); colored by Arg'), pause

disp('f(z) = log(z), the Principal Branch of Log.')
my_cplxmap(z,-i*log(z));view(2)
title('Log(z)')
disp('Height given by Arg(z); colored by radial -ln(r)'), pause

disp('f(z) = 1/z.  A simple pole at the origin.')
my_cplxmap(z,1./(z+eps*(abs(z)==0)),5*pi)
title('1/z')
disp(' '), pause

disp('f(z) = z^1/2.  Viewed from the negative imaginary axis.')
axis('auto')
my_cplxroot(2)
view(0,0)
title('sqrt(z)')
disp(' '), pause

disp('f(z) = z^1/2.  Another view.  The Riemann surface for the square root.')
view(-37.5,30)
my_cplxroot(2)
title('sqrt(z)')
disp(' '), pause

disp('f(z) = z^1/3.  The Riemann surface for the cube root.')
my_cplxroot(3)
title('z^(1/3)')
disp(' '), pause

disp('f(z) = asin(2z).  Branch cut singularities at +-i/2. ')
my_cplxmap(z,asin(2*z))
title('asin(2*z)')
disp(' '), pause


disp('End')
