COMPLEX ANALYSIS: Mathematica 3.0 Notebooks
(c) John H. Mathews, and
Russell W. Howell, 1998
Complimentary software to accompany our textbook:

COMPLEX ANALYSIS: for Mathematics and Engineering, 
3rd Edition,  1997,  ISBN: 0-7637-0270-6
Jones & Bartlett Publishers, Inc.
40 Tall Pine Drive, Sudbury, MA 01776
Tele.  (800) 832-0034, FAX:  (508)  443-8000
E-mail:  mkt@jbpub.com,     http://www.jbpub.com/
This free software is compliments of the authors.
mathews@fullerton.edu,  howell@westmont.edu

CHAPTER 3  ANALYTIC and HARMONIC FUNCTIONS
Section 3.1  Differentiable Functions
Section 3.2  The Cauchy-Riemann Equations
Section 3.3  Analytic Functions and Harmonic Functions
GoTo Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11.
GoTo Contents

CHAPTER 3  ANALYTIC and HARMONIC FUNCTIONS

Clear[a, b, difQuotient, dfdt, dfdx, Δf, 
      ΔfΔx, ΔfΔy, 
      ΔfΔz, Δx, Δy, 
      E1, E2, E3, E4, E5, f, F, g, g1, g2, g3, g4, g5, lap, lim, L1, L2, sub, 
      u, Ux, Uy, v, v1, v2, v3, Vx, Vy, w, x, x0, y, y0, z, z0];

Section 3.1  Differentiable Functions

Definition,  Page 71.  The definition for the derivative of  f(z)  at  z = (Subscript[z, 0])  is similar to that for real functions:
                    \(\(f\^'\)\)((Subscript[z, 0]))  =  (lim_(z -> (Subscript[z, 0])))  ((f(z) - f((Subscript[z, 0])))/(z - (Subscript[z, 0]))). 
                    
Theorem 3.1,  Page 73.  If  f(z)  is differentiable at  (Subscript[z, 0])  then  f(z)  is continuous at  (Subscript[z, 0]).

Example 3.1,  Page 71.  Use the limit definition to find the derivative of  f(z) = (z^3).

\(Clear[difQuotient, ΔfΔz, f, lim, sub, z, 
      z0]; 
f[z_]\  = \ z\^3; 
Print["f(z) = ", f[z]]; \)

Form the difference quotient.

\(ΔfΔz\  = \ 
      \(f[z] - f[z0]\)\/\(z\  - \ z0\); 

    Print[\*""\!\(Δf\/Δz\) = "", 
      ΔfΔz]; \)

Substitution of  (Subscript[z, 0])  for  z  is indeterminate.

\(sub\  = \ ReplaceAll[ΔfΔz, z\  -> z0]; 
    
Print[\*""Substitute z = z0 in Δ(f/Δ)z = "", 
      ΔfΔz]; 

    Print[\*""                     Δ(f/Δ)z = "", sub]; \)

The derivative is the limit of the difference quotient.

\(lim\  = \ Limit[ΔfΔz, \ z -> z0]; 

    Print[\*""\!\(df\/dz\) = \!\(lim\+\(z -> z0\)\) "", 
      ΔfΔz]; 

    Print[\*""\!\(df\/dz\) = "", lim]; \)

The difference quotient can be simplified before substitution of  (Subscript[z, 0])  for  z

\(difQuotient\  = \ Simplify[ΔfΔz]; 

    sub\  = \ ReplaceAll[difQuotient, z\  -> z0]; 

    Print[\*""\!\(df\/dz\) =  \!\(lim\+\(z -> z0\)\) "", 
      ΔfΔz]; 

    Print[\*""\!\(df\/dz\) =  \!\(lim\+\(z -> z0\)\) "", 
      difQuotient]; 
Print[\*""\!\(df\/dz\) = "", sub]; \)

Example 3.2,  Page 72.  Use the limit definition to show that  f(z)  =  (OverBar[z])  is NOWHERE differentiable.

\(Clear[Δf, ΔfΔx, 
      ΔfΔy, Δx, Δy, 
      f, x0, y0, z]; 
f[z_]\  = \ Conjugate[z]; 

    Print["f(z) = ", f[z]]; \)

First, form the difference quotient using  Δz = Δx.

\(ΔfΔx\  = \ 
      \(f[x0\  + \ Δx\  + \ I\ y0] - 
          f[x0\  + \ I\ y0]\)\/\(x0\  + \ Δx\  + \ 
          I\ y0\ \  - \ x0\  - \ I\ y0\); 

    Print[\*""\!\(Δf\/Δx\) = "", 
      ΔfΔx]; 

    ΔfΔx\  = \ 
      ComplexExpand[ΔfΔx]; 

    Print[\*""\!\(Δf\/Δx\) = "", 
      ΔfΔx]; \)

And this limit is easy to compute:

\(\(Print[
      \*""(lim_(Δx -> 0)) Δ(f/Δ)z = "", 
      Limit[ΔfΔx, Δx -> 0]]; 
    \)\)

Second, form the difference quotient using  Δz = i Δy.

\(ΔfΔy\  = \ 
      \(f[x0\  + \ I \((y0 + Δy)\)] - 
          f[x0\  + \ I\ y0]\)\/\(x0\  + \ 
          I \((y0 + Δy)\)\ \  - \ x0\  - \ 
          I\ y0\); 

    Print[\*""\!\(Δf\/Δy\) = "", 
      ΔfΔy]; 

    ΔfΔy\  = \ 
      ComplexExpand[ΔfΔy]; 

    Print[\*""\!\(Δf\/Δy\) = "", 
      ΔfΔy]; \)

And this limit is easy to compute:

\(\(Print[
      \*""(lim_(Δy -> 0)) Δ(f/Δ)y = "", 
      Limit[ΔfΔy, Δy -> 0]]; 
    \)\)

Since the two limits are different for any point (Subscript[z, 0 ]),  f  ' ((Subscript[z, 0 ]))  does NOT exist for any  (Subscript[z, 0]).
Mathematica will NOT find the derivative of  f(z)  =  (OverBar[z]).

Print[f'[x]];

The rules for differentiation on page 73.

\(Clear[a, a1, a2, b, b1, b2, F, f, g, g1, g2, g3, g4, g5, z]; 

    c\  = \ a\  + \ I\ b; 
g1[z_]\  = \ c\ f[z]; 
\(g1'\)[z]; 

    Print["Derivative of a scalar multiple."]; 

    Print[" F[z] = ", g1[z]]; 
Print[" F[z] = ", Expand[g1[z]]]; 

    Print[" "]; 
Print["F'[z] = ", \(g1'\)[z]]; 

    Print["F'[z] = ", Expand[\(g1'\)[z]]]; \)

\(g2[z_]\  = \ 
      \((a1 + I\ b1)\)\ f[z]\  + \ \((a2 + I\ b2)\)\ g[z]; 

    \(g2'\)[z]; 
Print["Derivative of a linear combination."]; 

    Print[" F[z] = ", g2[z]]; 
Print[" F[z] = ", Expand[g2[z]]]; 

    Print[" "]; 
Print["F'[z] = ", \(g2'\)[z]]; 

    Print["F'[z] = ", Expand[\(g2'\)[z]]]; \)

\(g3[z_]\  = \ f[z]\ g[z]; 
\(g3'\)[z]; 

    Print["Derivative of the product of two functions."]; 

    Print[" F[z] = ", g3[z]]; 
Print["F'[z] = ", \(g3'\)[z]]; \)

\(g4[z_]\  = \ f[z]\/g[z]; 

    Print["Derivative of the quotient of two functions."]; 

    Print[" F[z] = ", g4[z]]; 

    Print["F'[z] = ", Together[\(g4'\)[z]]]; \)

\(g5[z_]\  = \ f[g[z]]; 
\(g5'\)[z]; 

    Print["Derivative of the composition of two functions."]; 

    Print[" F[z] = ", g5[z]]; 

    Print["F'[z] = ", Together[\(g5'\)[z]]]; \)

Example 3.3,  Page 73.  Use the rules to find the derivative of   f(z) = (z^2)+ i 2 z + 3,  
and then use this result to find the derivative of  g(z) = (((f(z)))^4) =  ((((z^2) + i 2 z +3))^4).

\(Clear[f, g, z]; 
f[z_]\  = \ z\^2\  + \ I\ 2  z\  + \ 3; 

    g[z_]\  = \ f[z]\^4; 
Print[" f(z) = ", f[z]]; 

    Print["f'(z) = ", \(f'\)[z]]; 
Print[" "]; 

    Print[" g(z) = ", g[z]]; 
Print["g'(z) = ", \(g'\)[z]]; \)

L'Hopital's  Rule.

Mathematica can do it all, however care must be taken with the higher derivative cases.
Make the assumption that   f((Subscript[z, 0])) = 0  and  g((Subscript[z, 0])) = 0.

\(Clear[f, g, lim, z, z0]; 
f[z0]\  = \ 0; 
g[z0]\  = \ 0; 

    lim\  = \ Limit[f[z]\/g[z], \ z -> z0, \ Analytic -> True]; 

    Print["     f[z0] = ", f[z0]]; 
Print["     g[z0] = ", g[z0]]; 

    Print["    f'[z0] = ", \(f'\)[z0]]; 

    Print["    g'[z0] = ", \(g'\)[z0]]; 

    Print[\*""    \!\(f[z0]\/g[z0]\) = "", f[z0]\/g[z0]]; 

    Print[\*""\!\(lim\+\(z -> z0\)\) \!\(f[z]\/g[z]\) = "", lim]; 
    \)

Make the second additional assumption that   \(\(f\^'\)\)((Subscript[z, 0])) = 0  and   \(\(g\^'\)\)((Subscript[z, 0])) = 0.

\(\(f'\)[z0]\  = \ 0; 
\(g'\)[z0]\  = \ 0; 

    lim\  = \ Limit[f[z]\/g[z], \ z -> z0, \ Analytic -> True]; 

    Print["     f[z0] = ", f[z0]]; 
Print["     g[z0] = ", g[z0]]; 

    Print["    f'[z0] = ", \(f'\)[z0]]; 

    Print["    g'[z0] = ", \(g'\)[z0]]; 

    Print["   f''[z0] = ", \(\(f'\)'\)[z0]]; 

    Print["   g''[z0] = ", \(\(g'\)'\)[z0]]; 

    Print[\*""\!\(lim\+\(z -> z0\)\) \!\(f[z]\/g[z]\) = "", lim]; 
    \)

Make the third additional assumption that   ((f )^(''))((Subscript[z, 0])) = 0   and   (g^(''))((Subscript[z, 0])) = 0.

\(\(\(f'\)'\)[z0]\  = \ 0; 
\(\(g'\)'\)[z0]\  = \ 0; 

    lim\  = \ Limit[f[z]\/g[z], \ z -> z0, \ Analytic -> True]; 

    Print["     f[z0] = ", f[z0]]; 
Print["     g[z0] = ", g[z0]]; 

    Print["    f'[z0] = ", \(f'\)[z0]]; 

    Print["    g'[z0] = ", \(g'\)[z0]]; 

    Print["   f''[z0] = ", \(\(f'\)'\)[z0]]; 

    Print["   g''[z0] = ", \(\(g'\)'\)[z0]]; 

    Print["  f'''[z0] = ", \(\(\(f'\)'\)'\)[z0]]; 

    Print["  g'''[z0] = ", \(\(\(g'\)'\)'\)[z0]]; 

    Print[\*""\!\(lim\+\(z -> z0\)\) \!\(f[z]\/g[z]\) = "", lim]; 
    \)

An extra example  concerning L'Hopital's rule, This fits in on about page 74.

\(Clear[f, g, lim, z]; 

    f[z_]\  = \ z\^2\  + \ z\  - \ 1\  - \ 3  I; 

    g[z_]\  = \ z\^2\  - \ 2  z\  + \ 2; 
Print["f[z] = ", f[z]]; 

    Print["g[z] = ", g[z]]; \)

Direct substitution of   z = 1 + i   is indeterminate.

\(\(Print[
      \*""\!\(f[1 + I]\/g[1 + I]\) = "", 
      f[1 + I]\/g[1 + I]]; \)\)

Find the limit as   z -> 1 + i.

\(lim\  = \ Limit[f[z]\/g[z], z -> 1 + I]; 

    Print[\*""(lim_(z -> 1 + I))f[z]/g[z] = (lim_(z -> 1 + I))"", f[z]\/g[z]]; 

    Print[\*""          = (lim_(z -> 1 + I))"", 
      Cancel[f[z]\/g[z]]]; 
Print["          =  ", lim]; \)

Which agrees with the L'Hopital rule computation.

\(lim\  = \ Limit[\(f'\)[z]\/\(g'\)[z], z -> 1 + I]; 

    Print[\*""(lim_(z -> 1 + I)) f'[z]/(g')[z] = (lim_(z -> 1 + I)) "", \(f'\)[z]\/\(g'\)[z]]; 
Print["            = ", lim]\)

Which agrees with evaluation of the quotient  ((f'(1 + i))/(g' (1 + i))).

\(Print["  f'[1+I] = ", \(f'\)[1 + I]]; 

    Print["  g'[1+I] = ", \(g'\)[1 + I]]; 

    Print[\*""f'[1 + I]/(g')[1 + I] = "", \(f'\)[1 + I]\/\(g'\)[1 + I]]; \)

GoTo Chapter 3

Section 3.2  The Cauchy-Riemann Equations

Theorem 3.2,  Page 77. (Cauchy-Riemann Equations)  
Let  f (z) = f (x + iy) =  u (x, y) + i v (x, y)  be differentiable at   (Subscript[z, 0])=(Subscript[x, 0])+i (Subscript[y, 0]).  Then the partial derivatives of  u  and  v  exist at ((Subscript[x, 0]),(Subscript[y, 0])) and satisfy the Cauchy-Riemann Equations
               (Subscript[u, x])((Subscript[x, 0]),(Subscript[y, 0]))  =  (Subscript[v, y])((Subscript[x, 0]),(Subscript[y, 0]))    and   (Subscript[u, y])((Subscript[x, 0]),(Subscript[y, 0]))  =  - (Subscript[v, x])((Subscript[x, 0]),(Subscript[y, 0])).

Theorem 3.3,  Page 79.  (Sufficient Conditions)  
Let  f (z) = f (x + iy) =  u (x, y) + i v (x, y) be a continuous function that is defined in some neighborhood of the point   (Subscript[z, 0])=(Subscript[x, 0])+i (Subscript[y, 0]).  If all of the first order partial derivatives are continuous at the point  ((Subscript[x, 0]),(Subscript[y, 0]))  and if the Cauchy-Riemann equations hold, then  f(z)  is differentiable at (Subscript[z, 0]).

Theorem 3.4,  Page 82.  (Polar Form)  
Let  f (z) = u (r, θ) + i v (r, θ)  be a continuous function that is defined in some neighborhood of the point   (Subscript[z, 0])=(Subscript[r, 0]) (e^i)(Subscript[θ, 0]).  If all of the first order partial derivatives are continuous at the point  ((Subscript[r, 0]),(Subscript[θ, 0]))  and if the Cauchy-Riemann equations
(Subscript[u, r])((Subscript[r, 0]),(Subscript[θ, 0]))  = (1/(Subscript[r, 0])) (Subscript[v, θ])((Subscript[r, 0]),(Subscript[θ, 0]))    and   (Subscript[u, r])((Subscript[r, 0]),(Subscript[θ, 0]))  = ((- 1)/(Subscript[r, 0]))(Subscript[v, θ])((Subscript[r, 0]),(Subscript[θ, 0]))
hold, then  f(z)  is differentiable at (Subscript[z, 0]).

Derivation of the Cauchy-Riemann equations with Mathematica.

\(Clear[Δx, Δy, E1, E2, E3, E4, E5, f, L1, 
      L2, u, v, x, y]; 
x /: Im[x] = 0; 
y /: Im[y] = 0; 

    u /: Im[u[x, y]] = 0; 
v /: Im[v[x, y]] = 0; 
x /: Re[x] = x; 

    y /: Re[y] = y; 
u /: Re[u[x, y]] = u[x, y]; 

    v /: Re[v[x, y]] = v[x, y]; 

    f[x_\  + \ I\ y_]\  := \ 
      u[x, y]\  + \ I\ v[x, y]; 

    L1\  = \ Limit[
        \(f[x + Δx + I\ y] - 
            f[x + I\ y]\)\/Δx, 
        Δx -> 0, Analytic -> True]; 

    L2\  = \ Limit[
        \(f[x + I \((y + Δy)\)] - 
            f[x + I\ y]\)\/\(I\ Δy\), 
        Δy -> 0, Analytic -> True]; 

    Print["    f(z) = ", f[x\  + \ I\ y]]; 

    Print["Re[f(z)] = ", ComplexExpand[Re[f[x + I\ y]]]]; 

    Print["Im[f(z)] = ", ComplexExpand[Im[f[x + I\ y]]]]; 

    Print[" "]; 

    Print[\*""(lim_(Δx -> 0))  Δ(f/Δ)x = "", L1]; 

    Print[\*""(lim_(Δy -> 0)) \!\(Δf\/\(I\\ Δy\)\) = "", L2]; 

    Print[""]\)\(E1\  = \ L1\  == \ L2; 
Print[E1]; 
Print[" "]; 

    E2\  = \ ReplaceAll[
        E1, {I -> 0, \(-I\) -> 0}]; 

    Print[E2]; 
E3\  = \ Thread[\(-E1\), Equal]; 

    E4\  = \ Thread[E2 + E3, Equal]; 

    E5\  = \ ReplaceAll[
        E4, {I -> 1, \(-I\) -> \(-1\)}]; 

    Print[E5]; \)

These are the Cauchy-Riemann equations  
          (Subscript[u, x])(x,y) = (Subscript[v, y])(x,y)   and (Subscript[u, y])(x,y) = - (Subscript[v, x])(x,y).

Example 3.4,  Page 78.  The function  f(z)  =  (z^3)  =  (x^3) - 3x(y^2) + i(3(x^2)y - (y^3))
is known to be differentiable. Verify that its derivative satisfies the results of the 
Cauchy-Riemann equations.

\(Clear[f, x, y, u, v, w, w1, z]; 
f[z_]\  = \ z\^3; 

    w\  = \ ComplexExpand[f[x + I\ y]]; 

    u[x_, y_]\  = \ ComplexExpand[Re[f[x + I\ y]]]; 

    v[x_, y_]\  = \ ComplexExpand[Im[f[x + I\ y]]]; 

    Print["  f[z] = ", f[z]]; 
Print["  f[z] = ", w]; 

    Print["u[x,y] = ", u[x, y]]; 
Print["v[x,y] = ", v[x, y]]; \)

\(w1\  = \ 
      ∂\_x\ u[x, y]\ \  + \ \ 
        I\ ∂\_x\ v[x, y]; 

    Print["f'[z] = ", \(f'\)[x + I\ y]]; 

    Print["f'[z] = ", ComplexExpand[\(f'\)[x + I\ y]]]; 

    Print[" "]; 

    Print[\*""f'[z] = (Subscript[u, x])[x,y]+ I (Subscript[v, x])[x,y]""]; 
Print["f'[z] = ", w1]; \)

Example 3.5,  Page 79.  Verify that the complex function  f(z)  =  (((( \(z\&_\) ))^2)/z) is NOT analytic.

\(Clear[f, u, Ux, Ux0, Uy, Uy0, v, Vx, Vx0, Vy, Vy0, w, x, y]; 

    x /: Im[x] = 0; 
y /: Im[y] = 0; 
x /: Re[x] = x; 
y /: Re[y] = y; 

    w\  = \ Conjugate[x + I\ y]\^2\/\(x + I\ y\); 

    Print["w = ", w]; 

    w\  = \ ComplexExpand[w, TargetFunctions -> {Im, Re}]; 

    Print["w = ", w]; \)

\(u[x_, y_]\  = \ Together[ComplexExpand[Re[w]]]; 

    v[x_, y_]\  = \ Together[ComplexExpand[Im[w]]]; 
u[0, 0]\  = \ 0; 

    v[0, 0]\  = \ 0; 
f[x_, y_]\  = \ u[x, y]\  + \ I\ v[x, y]; 
    
f[0, 0]\  = \ 0; 
Print["u[x,y] = ", u[x, y]]; 

    Print["v[x,y] = ", v[x, y]]; 
Print["  f[z] = ", f[x, y]]; \)

\(Ux\  = \ Together[∂\_x\ u[x, y]]; 

    Uy\  = \ Together[∂\_y\ u[x, y]]; 

    Vx\  = \ Together[∂\_x\ v[x, y]]; 

    Vy\  = \ Together[∂\_y\ v[x, y]]; 

    Print[\*""\!\(u\_x\)[x,y] = "", Ux]; 

    Print[\*""\!\(u\_y\)[x,y] = "", Uy]; 

    Print[\*""\!\(v\_x\)[x,y] = "", Vx]; 

    Print[\*""\!\(v\_y\)[x,y] = "", Vy]; 

    Print[\*""\!\(u\_x\)[x,y] - \!\(v\_y\)[x,y] = 0 = "", 
      Simplify[Ux - Vy]]; 

    Print[\*""\!\(u\_y\)[x,y] + \!\(v\_x\)[x,y] = 0 = "", 
      Simplify[Uy + Vx]]; \)

Hence the function  f  is differentiable only when  (x^2) - (y^2) = 0   and   - 8 x y = 0  hence
at the origin.   Let's check to see if the Cauchy-Riemann equations hold at  (0,0).

\(Ux0\  = \ 
      Limit[\(u[x, 0] - u[0, 0]\)\/\(x - 0\), \ x -> 0, \ 
        Analytic -> True]; 

    Vy0\  = \ Limit[\(v[0, y] - v[0, 0]\)\/\(y - 0\), \ y -> 0, \ 
        Analytic -> True]; 

    Uy0\  = \ Limit[\(u[0, y] - u[0, 0]\)\/\(y - 0\), \ y -> 0, \ 
        Analytic -> True]; 

    Vx0\  = \ Limit[\(v[x, 0] - v[0, 0]\)\/\(x - 0\), \ x -> 0, \ 
        Analytic -> True]; 
Print[\*""\!\(u\_x\)[0,0] = "", Ux0]; 
    
Print[\*""\!\(u\_y\)[0,0] = "", Uy0]; 

    Print[\*""\!\(v\_x\)[0,0] = "", Vx0]; 

    Print[\*""\!\(v\_y\)[0,0] = "", Vy0]; 

    Print[\*""\!\(u\_x\)[0,0] =  \!\(v\_y\)[0,0],    "", Ux0 == Vy0]; 

    Print[\*""\!\(u\_y\)[0,0] = -\!\(v\_x\)[0,0],    "", 
      Uy0 == \(-Vx0\)]; \)

So,  (Subscript[u, x])(x,y) = (Subscript[v, y])(x,y)  and  (Subscript[u, y])(x,y) = - (Subscript[v, x])(x,y).

And  f  is NOT analytic at (0,0) because the following two limits are distinct.

\(dfdx\  = \ 
      Limit[\(f[x, 0] - f[0, 0]\)\/x, x -> 0, Analytic -> True]; 

    dfdt\  = \ 
      Limit[\(f[t, t] - f[0, 0]\)\/\(t + I\ t\), t -> 0, 
        Analytic -> True]; 
Print["Along  the  x=axis:"]; 

    Print[\*""(lim_(x -> 0)) (df/dx) = (lim_(x -> 0)) ((f[x, 0] - f[0, 0])/x)""]; 

    Print[\*""(lim_(x -> 0)) (df/dx) = "", dfdx]; 

    Print["Along the line y=x:"]; 

    Print[\*""(lim_(t -> 0)) (df/dt) = (lim_(t -> 0)) \!\(\(f[t, t] - f[0, 0]\)\/\(t + I\\ t\)\)""]; 
    
Print[\*""(lim_(t -> 0)) (df/dt) = "", dfdt]; 
    \)

Example 3.6,  Page 81.  Use the Cauchy-Riemann equations to show that  
f(z) = (e^(-y))cos x  +  i (e^(-y))sin x    is differentiable for all   z = x + iy.

\(Clear[f, u, Ux, Uy, v, Vx, Vy, w1, x, y, z]; 

    u[x_, y_]\  = \ Exp[\(-y\)] Cos[x]; 
v[x_, y_]\  = \ Exp[\(-y\)] Sin[x]; 
    
Ux\  = \ Together[∂\_x\ u[x, y]]; 

    Uy\  = \ Together[∂\_y\ u[x, y]]; 

    Vx\  = \ Together[∂\_x\ v[x, y]]; 

    Vy\  = \ Together[∂\_y\ v[x, y]]; 

    Print[" U[x,y] = ", u[x, y]]; 
Print[" V[x,y] = ", v[x, y]]; 

    Print[\*""\!\(u\_x\)[x,y] = "", Ux]; 

    Print[\*""\!\(u\_y\)[x,y] = "", Uy]; 

    Print[\*""\!\(v\_x\)[x,y] = "", Vx]; 

    Print[\*""\!\(v\_y\)[x,y] = "", Vy]; 

    Print[\*""\!\(u\_x\)[x,y] =  \!\(v\_y\)[x,y],    "", Ux == Vy]; 

    Print[\*""\!\(u\_y\)[x,y] = -\!\(v\_x\)[x,y],    "", 
      Uy == \(-Vx\)]; \)

The Cauchy-Riemann equations hold everywhere, so that
f(z) = (e^(-y))cos x  +  i (e^(-y))sin x    is analytic for all values of  z.

Print["f[z] = ", u[x, y]  +  I v[x, y]];

Remark.  We can write this function as  f(z) = (e^iz)  = (e^(-y + ix)), and investigate f '(z).

\(f[z_]\  = \ E\^\(I\ z\); 

    w1\  = \ ∂\_x\ u[x, y]\ \  + \ \ 
        I\ ∂\_x\ v[x, y]; 

    Print["    f[z] = ", f[z]]; 

    Print[" f[x+Iy] = ", f[x + I\ y]]; 

    Print[" f[x+Iy] = ", 
      ComplexExpand[f[x\  + \ I\ y]]]; 
Print[" "]; 

    Print["f'[x+Iy] = ", \(f'\)[x + I\ y]]; 

    Print["f'[x+Iy] = ", 
      ComplexExpand[\(f'\)[x + I\ y]]]; 
Print[" "]; 

    Print[\*""f'[x+Iy] = (Subscript[u, x])[x,y]+ I (Subscript[v, x])[x,y]""]; 
Print["f'[x+Iy] = ", w1]; \)

Example 3.7,  Page 81.  Show that the complex function  
     f(z)  =  (x^3)  +  3x(y^2)  +  i ((y^3) + 3(x^2)y)
is differentiable only at points that lie on the coordinate axes.

\(Clear[u, Ux, Uy, v, Vx, Vy, x, y]; 

    u[x_, y_]\  = \ x\^3\  + \ 3\ x\ y\^2; 

    v[x_, y_]\  = \ y\^3\  + \ 3\ x\^2\ y; 

    Ux\  = \ Together[∂\_x\ u[x, y]]; 

    Uy\  = \ Together[∂\_y\ u[x, y]]; 

    Vx\  = \ Together[∂\_x\ v[x, y]]; 

    Vy\  = \ Together[∂\_y\ v[x, y]]; 

    Print[" u[x,y] = ", u[x, y]]; 
Print[" v[x,y] = ", v[x, y]]; 

    Print[\*""\!\(u\_x\)[x,y] = "", Ux]; 

    Print[\*""\!\(u\_y\)[x,y] = "", Uy]; 

    Print[\*""\!\(v\_x\)[x,y] = "", Vx]; 

    Print[\*""\!\(v\_y\)[x,y] = "", Vy]; 

    Print[\*""\!\(u\_x\)[x,y] =  \!\(v\_y\)[x,y],      "", Ux == Vy]; 

    Print[\*""\!\(u\_y\)[x,y] = -\!\(v\_x\)[x,y],      "", 
      Uy == \(-Vx\)]; 

    Print[\*""\!\(u\_y\)[x,y] + \!\(v\_x\)[x,y] = 0,   "", 
      Uy + Vx == 0]; \)

The Cauchy-Riemann equations hold only if  xy = 0.   
Hence, f(z)  =  (x^3)  +  3x(y^2)  +  i ((y^3) + 3(x^2)y)  is analytic only when  x = 0 or y = 0,
which occurs at points that lie on the coordinate axes.

Example 3.8,  Page 82.  Show that if  f (z)  is given by
	f (z)=(z^(1/2)) = (r^(1/2))(cos((θ/2))+i sin((θ/2)))
where the domain is restricted to be  r > 0  and  , then the derivative is given by  -π < θ < π,  then the derivative is given by
	f'(z)=(1/(2 (z^(1/2))))= (((r^(-1/2)))/2)(cos((θ/2))-i sin((θ/2))),
where  r > 0  and  -π < θ < π.
Solution.  First, verify that  f (z)  satisfies the polar form of the Cauchy-Riemann equations.

Clear[r, θ, u, v]\(u[r_, θ_] = \(r\^\(1/2\)\) Cos[θ\/2]; 

    v[r_, θ_] = \(r\^\(1/2\)\) Sin[θ\/2]; 

    Ur\  = ∂\_r\ u[r, θ]; 

    Uθ\  = ∂\_θ\ u[r, θ]; 

    Vr\  = ∂\_r\ v[r, θ]; 

    Vθ\  = ∂\_θ\ v[r, θ]; 

    Print["u[r,θ] = ", u[r, θ]]; 

    Print["v[r,θ] = ", u[r, θ]]; 

    Print[\*""(∂_r) u[r,θ] = "", 
      ∂\_r\ u[r, θ]]; 

    Print[\*""(∂_θ) u[r,θ] = "", 
      ∂\_θ\ u[r, θ]]; 

    Print[\*""(∂_r) v[r,θ] = "", 
      ∂\_r\ v[r, θ]]; 

    Print[\*""(∂_θ) v[r,θ] = "", 
      ∂\_θ\ v[r, θ]]; 
Print[" "]; 

    Print[\*""(∂_r) u[r,θ] = (1/r) (∂_θ) v[r,θ] ?,   "", 
      ∂\_r\ u[r, θ] == 
        1\/r\ ∂\_θ\ v[r, θ]]; 

    Print[\*""(∂_r) v[r,θ] = ((-1)/r) (∂_θ) u[r,θ] ?,  "", 
      ∂\_r\ v[r, θ] == 
        \(-1\)\/r\ ∂\_θ\ u[r, θ]]; \)

Second, the polar form of the Cauchy-Riemann equations to find  f'(z).

Print["
f'(z) = ",(E^(-I θ)) 
            ((∂_r) u[r, θ] + 
                I (∂_r) v[r, θ])];
Print["
f'(z) = ",ComplexExpand[(E^(-I θ))] 
            ((∂_r) u[r, θ] + 
                I (∂_r) v[r, θ])];
Print["
f'(z) = ",Simplify[
            ComplexExpand[(E^(-I θ))] 
              ((∂_r) u[r, θ] + 
                  I (∂_r) v[r, θ])]];

GoTo Chapter 3

Section 3.3  Analytic Functions and Harmonic Functions

The function  f  is said to be analytic at  (Subscript[z, 0])  if its derivative exists 
at each point  z  in some neighborhood of  (Subscript[z, 0]).

Theorem 3.5,  Page 85.  Let f (z) = f (x + iy) =  u (x, y) + i v (x, y)  be an analytic function in the domain  D.  If all second-order partial derivatives of  u  and  v  are continuous,
then both   u(x,y)   and   v(x,y)   are harmonic function in   D.

Theorem 3.6,  Page 87.  (Construction of a Conjugate)  Let  u(x,y)  be harmonic in an  ϵ-neighborhood of the point  ((Subscript[x, 0]),(Subscript[y, 0])).  Then there exists a conjugate harmonic function  v(x,y)  defined in this neighborhood, and  f (z) = u (x, y) + i v (x, y) is an analytic function.

Example 3.9,  Page 84.  Show that the complex function  f(z) = (x^2) + (y^2) + i 2x y  is NOWHERE analytic.

\(Clear[u, Ux, Uy, v, Vx, Vy, x, y]; 
u[x_, y_]\  = \ x\^2\  + \ y\^2; 

    v[x_, y_]\  = \ 2\ x\ y; 
Ux\  = \ ∂\_x\ u[x, y]; 

    Uy\  = \ ∂\_y\ u[x, y]; 
Vx\  = \ ∂\_x\ v[x, y]; 

    Vy\  = \ ∂\_y\ v[x, y]; 
Print[" u[x,y] = ", u[x, y]]; 

    Print[" v[x,y] = ", v[x, y]]; 

    Print[\*""\!\(u\_x\)[x,y] = "", Ux]; 

    Print[\*""\!\(u\_y\)[x,y] = "", Uy]; 

    Print[\*""\!\(v\_x\)[x,y] = "", Vx]; 

    Print[\*""\!\(v\_y\)[x,y] = "", Vy]; 

    Print[\*""\!\(u\_x\)[x,y] =  \!\(v\_y\)[x,y],      "", Ux == Vy]; 

    Print[\*""\!\(u\_y\)[x,y] = -\!\(v\_x\)[x,y],      "", 
      Uy == \(-Vx\)]; 

    Print[\*""\!\(u\_y\)[x,y] + \!\(v\_x\)[x,y] = 0,   "", 
      Uy + Vx == 0]; \)

So  f(z)  is differentiable only when  4y = 0  or  y = 0.
Since f(z) is NOT differentiable in any open neighborhood, it is NOWHERE analytic.

Example 3.10,  Page 86.  Show that both   u(x,y) = (x^2) - (y^2)  and  v(x,y) = 2 x y 
are harmonic functions.

\(Clear[u, Ux, Uy, v, Vx, Vy, w, x, y, z]; 
x /: Im[x] = 0; 

    y /: Im[y] = 0; 
x /: Re[x] = x; 
y /: Re[y] = y; 

    z\  = \ x\  + \ I\ y; 
w\  = \ ComplexExpand[z\^2]; 

    u[x_, y_]\  = \ ComplexExpand[Re[w]]; 

    v[x_, y_]\  = \ ComplexExpand[Im[w]]; 
Ux\  = \ ∂\_x\ u[x, y]; 
    
Uy\  = \ ∂\_y\ u[x, y]; 
Vx\  = \ ∂\_x\ v[x, y]; 

    Vy\  = \ ∂\_y\ v[x, y]; 
Print[" u[x,y] = ", u[x, y]]; 

    Print[" v[x,y] = ", v[x, y]]; 

    Print[\*""\!\(u\_x\)[x,y] = "", Ux]; 

    Print[\*""\!\(u\_y\)[x,y] = "", Uy]; 

    Print[\*""\!\(v\_x\)[x,y] = "", Vx]; 

    Print[\*""\!\(v\_y\)[x,y] = "", Vy]; 

    Print[\*""\!\(u\_x\)[x,y] =  \!\(v\_y\)[x,y],      "", Ux == Vy]; 

    Print[\*""\!\(u\_y\)[x,y] = -\!\(v\_x\)[x,y],      "", 
      Uy == \(-Vx\)]; \)

So  f(x+iy)  =  u(x,y)  +  i v(x,y)  is analytic for all  z = x + i y.
And  u(x,y) = Re[f(x+iy)]  and  v(x,y) = Im[f(x+iy)]  are both harmonic functions.

Example 3.11,  Page 86. Show that both  u(x,y)  =  (x^3) - 3 x (y^2)  and  v(x,y)  =  3 x (y^2) - (y^3)  are harmonic functions.

\(Clear[u, Ux, Uy, v, Vx, Vy, w, x, y, z]; 
x /: Im[x] = 0; 

    y /: Im[y] = 0; 
x /: Re[x] = x; 
y /: Re[y] = y; 

    z\  = \ x\  + \ I\ y; 
w\  = \ Expand[z\^3]; 

    u[x_, y_]\  = \ ComplexExpand[Re[w]]; 

    v[x_, y_]\  = \ ComplexExpand[Im[w]]; 
Ux\  = \ ∂\_x\ u[x, y]; 
    
Uy\  = \ ∂\_y\ u[x, y]; 
Vx\  = \ ∂\_x\ v[x, y]; 

    Vy\  = \ ∂\_y\ v[x, y]; 
Print[" u[x,y] = ", u[x, y]]; 

    Print[" v[x,y] = ", v[x, y]]; 

    Print[\*""\!\(u\_x\)[x,y] = "", Ux]; 

    Print[\*""\!\(u\_y\)[x,y] = "", Uy]; 

    Print[\*""\!\(v\_x\)[x,y] = "", Vx]; 

    Print[\*""\!\(v\_y\)[x,y] = "", Vy]; 

    Print[\*""\!\(u\_x\)[x,y] =  \!\(v\_y\)[x,y],      "", Ux == Vy]; 

    Print[\*""\!\(u\_y\)[x,y] = -\!\(v\_x\)[x,y],      "", 
      Uy == \(-Vx\)]; \)

So  f(x+iy)  =  (x^3) - 3x(y^2) +  i (3x(y^2) - (y^3))   is analytic for all  z = x + i y.
And  u(x,y) = Re[f(x+iy)]  and  v(x,y) = Im[f(x+iy)]  are both harmonic functions.

Method. Construction of the Harmonic Conjugate of u(x,y).
First, execute the following subroutine.

Execute this cell to activate Construction of the Harmonic Conjugate.

\(Clear[lap, u, v, v1, v2, v3, x, y]; 

    con[u0_]\  := \ 

      Module[{u}, 
\ \ Set@@{u[x_, y_], u0}; 
\ \ 
        lap\  = \ 
          Simplify[
            ∂\_\(x, x\)u[x, y]\  + \ ∂\_\(y, y\)u[x, y]]; 
        
\ \ If[lap =!= 0, Print["u[x,y] was Not harmonic"]; 
\ \ \ \ \ 
          Print["u(x,y) = ", u[x, y]]; 
\ \ \ \ \ 
          Print[\*""\!\(u\_xx\) + \!\(u\_yy\) = ""]; \ 
          Return[Print[Expand[lap]]]]; 
\ \ 
        v1\  = ∫∂\_x\ u[x, y] \[DifferentialD]y; 
\ \ 
        v2\  = \ \(-\ ∂\_y\ u[x, y]\)\  - \ ∂\_x\ v1; 

        \ \ v3\  = ∫v2 \[DifferentialD]x; 
\ \ 
        Return[v1\  + \ v3]; \ ]; \)

Example 3.12,  Page 88.  Show that   u(x,y)  =  x (y^3) - (x^3)y   is a harmonic function
and find the harmonic conjugate  v(x,y).

\(u[x_, y_]\  = \ x\ y\^3\  - \ x\^3\ y; 
v[x_, y_]\  = \ con[u[x, y]]; 
    
Print["u(x,y) = ", u[x, y]]; 

    Print["Constructing the harmonic conjugate we get:"]; 

    Print["v(x,y) = ", v[x, y]]; \)

\(Ux\  = \ ∂\_x\ u[x, y]; 
Uy\  = \ ∂\_y\ u[x, y]; 

    Vx\  = \ ∂\_x\ v[x, y]; 
Vy\  = \ ∂\_y\ v[x, y]; 

    Print["      w = ", u[x, y]\  + \ I\ v[x, y]]; 

    Print[" u[x,y] = ", u[x, y]]; 
Print[" v[x,y] = ", v[x, y]]; 

    Print[\*""\!\(u\_x\)[x,y] = "", Ux]; 

    Print[\*""\!\(u\_y\)[x,y] = "", Uy]; 

    Print[\*""\!\(v\_x\)[x,y] = "", Vx]; 

    Print[\*""\!\(v\_y\)[x,y] = "", Vy]; 

    Print[\*""\!\(u\_x\)[x,y] =  \!\(v\_y\)[x,y],      "", Ux == Vy]; 

    Print[\*""\!\(u\_y\)[x,y] = -\!\(v\_x\)[x,y],      "", 
      Uy == \(-Vx\)]; \)

Example 3.13,  Page 88.  Let  f (z)  be an analytic function in the domain  D.  If  | f (z) | 
         ≡ K  where  K  is a constant, then  f (z)  is constant in  D.
Solution.  The solution is given in the textbook.

Example 3.14,  Page 91.  Show that   u(x,y)  =  (x^2) - (y^2)   is the scalar potential 
function for the fluid flow:  v(x,y)  =  2x  -  i 2y.

\(Clear[F, u, z]; 
F[z_]\  = \ z\^2; 

    u[x_, y_]\  = \ ComplexExpand[Re[F[x + I\ y]]]; 

    v[x_, y_]\  = \ ComplexExpand[Im[F[x + I\ y]]]; 

    Print["  F(z) = ", F[z]]; 

    Print[" F'(z) = ", Expand[\(F'\)[x + I\ y]]]; 

    Print[\*"" \!\(\(F' \((z)\)\)\&_\) = "", 
\ \ \ \ \ \ \ 
      ComplexExpand[Conjugate[\(F'\)[x + I\ y]]]]; 

    Print["u(x,y) = ", u[x, y]]; 
Print["v(x,y) = ", v[x, y]]; \)

\(ContourPlot[v[x, y], {x, 0, 5}, {y, 0, 5}, Contours\  -> \ 10, 
      PlotPoints -> 25, AspectRatio -> 1, 
      AxesLabel -> {"x", "y"}, ColorFunction -> Hue]; 

    Print["  Contour plot for  v(x,y) = ", v[x, y]]; \)

GoTo Chapter 3