- The Function z^k:
This code shows the real part of the complex function zk over the unit disc in the complex plane.
Two branches of the function are shown (when it is multivalued).
The variables p and q represent the starting and ending exponents of the function, while n is the number of frames.
Since there is often a problem at 0, the variable rm defines the smallest radius at which the function is evaluated (it uses polar coordinates).
To see the imaginary part of the same function, change the "cos(i*t)" in the eighth line into a "sin(i*t)."
(However, they are identical modulo rotation.)
restart: with(plots):
p := 0: q := 2: # start & end exponents
rm := .01: n := 24: # start radius & frames
br := 2: # number of branches shown
m := (n,k) -> min(n/gcd(round(12*n*k)/12,n),br):
for k from 0 to n do
i := p+(q-p)*k/n:
an1[k] := plot3d([r*cos(t),r*sin(t),r^i*cos(i*t)],
r=rm..1, t=0..2*m(n,i)*Pi,
grid=[12,18*m(n,i)], view=-1.5..1.5):
end do:
an2 := plots[display]([seq(an1[k],k=0..n)],insequence=true):
display(an2,insequence=true);
- Branches of the Function zp/q:
This code shows all branches of the real part of the function zp/q over the unit disc in the complex plane.
The constants p and q represent the numerator and denominator of the exponent.
Since the origin often presents problems, the polar coordinates start at an inner radius of rm=.01 instead of 0, though this can be reset.
To see the complex part of the same function, replace the cos(p/q*t) in the sixth line with sin(p/q*t).
(However, they are identical modulo rotation.)
restart: with(plots):
p := -1: q := 3: # numerator & denom. of exponent
rm := .01: n := 12: # minimum radius, number of frames
m := q/gcd(p, q): # this is the number of branches
for k from 1 to n do
an1[k] := plot3d([r*cos(t), r*sin(t), r^(p/q)*cos(p/q*t)],
r=rm..1, t=0..m*2*k*Pi/n, view=-1.5..1.5,
grid=[12,round(18*m*k/n)]):
end do:
an2 := plots[display]([seq(an1[k],k=1..n)],insequence=true):
an3 := plot3d(-2,x=0..0.5,y=0..0.5,view=-1.5..1.5):
display(an2,an3);