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

COMPLEX ANALYSIS: for Mathematics and Engineering, 
4th Edition,  2001,  ISBN: 0-7637-1425-9
Jones & Bartlett Publishers, Inc.  
40 Tall Pine Drive, Sudbury, MA 01776  
Tele.  (800) 832-0034, FAX:  (508)  443-8000  
E-mail:  mkt@jbpub.com  
Internet:  http://www.jbpub.com/  
This free software is compliments of the authors.
John H. Mathews,   mathews@fullerton.edu 
Russell W. Howell,  howell@westmont.edu

CHAPTER 10  APPLICATIONS of HARMONIC FUNCTIONS

a = A = b = B = c = k = R = T = u = U = v = V = w = W = x = X = y = Y = z = Z = 
                                        0; 
Clear[a, a0, a1, a2, a3, A, b, B, 
        CR, Δx, Δy, eq1, eq2, eqns, f, f1, F, F1, 
        F2, F3, F4, g, G, lines, n, P, Ψ, ϕ, Φ, 
        r, r0, solset, θ, t, T, T1, T2, Q, u, u0, U, U1, v, v0, V, V1, 
        w, w0, W, W1, x, x1, x2, x3, y, z, z1, z2, z3, 
        z4]; 
Needs["Graphics`ComplexMap`"]; 
Needs["Graphics`ParametricPlot3D`"]
Needs["Graphics`Colors`"];

Section 10.1	Preliminaries

Section 10.2	Invariance of Laplace's Equation and the Dirichlet Problem

Section 10.3	Poisson's Integral Formula for the Upper Half Plane

Section 10.4	Two Dimensional Mathematical Models

Section 10.5	Steady State Temperatures

Section 10.6	Two-Dimensional Electrostatics

Section 10.7  Two-Dimensional Fluid Flow

Suppose that a fluid flows over the complex plane and that the velocity at the point  z = x + i y  is given by the velocity vector  

	V(x, y)=p (x, y) + i q (x, y).  

We also require that the velocity does not depend on time and that the components  p(x,y)  and  q(x,y)  have continuous partial derivatives.  The divergence of the vector field is given by

	div V(x, y)=(Subscript[p, x]) (x, y) + i (Subscript[q, y]) (x, 
              y)  

and is a measure of the extent to which the velocity field diverges near the point.  We ill consider only fluid flows for which the divergence is zero.  This is more precisely characterized by requiring that the net flow through any simple closed contour be identically zero.  A short derivation will show that 

	(Subscript[p, x]) (x, y)  +  (Subscript[q, y]) (x, y)  =  0,

which is called the equation of continuity.  See text page 350 for details.

	The curl of the velocity vector has magnitude

	|curl V(x, y)| = (Subscript[q, x]) (x, y)  -  (Subscript[p, y]) (x, y)

and is an indication of how the field swirls in the vicinity of a point.  Imagine that a "fluid element" at the point (x,y) is suddenly frozen and then moves freely in the fluid.  It can be shown that the fluid element will rotate with an angular velocity given by

	(1/2) (Subscript[q, x]) (x, y)  -  (1/2) (Subscript[p, y]) (x, 
              y) = (1/2)|curl V(x, y)|.

We will consider only fluid flows for which the curl is identically zero.  Such fluid flows are called irrotational.

The function  f (z) = p (x, y) - i q (x, y)  satisfies the Cauchy-Riemann equations and is an analytic function.  Let  F (z)  denote the antiderivative of  f (z).  Then

	F (z) = ϕ (x, y) + i ψ (x, y)  

is called the complex potential of the flow and has the property

	\(\(F' \((w)\)\)\&_\) = (Subscript[ϕ, x]) (x, 
                y) - i (Subscript[ψ, x]) (x, y)
         =p (x, y) + i q (x, y)
       =V(x, y)

Since  (Subscript[ϕ, x]) = p  and  (Subscript[ϕ, y]) = q, we also have 

	grad ϕ (x, y)=p (x, y) + i q (x, y)=V(x, y)

so  ϕ (x, y) is the velocity potential for the flow, and the curves ϕ (x, y) = (Subscript[K, 1])  are called equipotentials.  The function  ψ (x, y)  is called the stream function, and the curves  ψ (x, y) = (Subscript[K, 2])  are called streamlines, and describe the paths of the fluid particles.

Theorem 10.5  (Invariance of Flow),  Page 435.  Let  

			(Subscript[F, 1]) (w) = Φ (u, v) + 
          i Ψ (u, v)  

denote the complex potential for a fluid flow in a domain  G  in the  w plane where the velocity is  

			(Subscript[V, 1])(u, v)= \(\(F\_1' \((w)\)\)\&_\).  

If the function    w = S (z) = u (x, y) + i v (x, y)  is a one-to-one conformal mapping from a domain  D  in the  z plane onto  G,  then the composite function  

	(Subscript[F, 2]) (z) = (Subscript[F, 1]) (S (z))= Φ (u (x, y), v (x, y)) + 
        i Ψ (u (x, y), v (x, y))  

is the complex potential for a fluid flow in  D  where the velocity is  

			(Subscript[V, 2])(x, y)= (OverBar[((Subscript[F, 2]))'(z)]).

Proof of Theorem 10.5, see text Page 435.

Example 10.22,  Page 436.  The complex potential  F[z] = (a + i b) z  has the velocity potential and stream function given by  ϕ[x, y] = a x - b y  and   φ[x, y] = b x + a y,  respectively.

Solution 10.22.

The function  F[z] = (a + i b) z  is the antiderivative of   f[z] = (a + i b).  It gives rise to the fluid flow defined in the entire complex plane that has a uniform parallel velocity vector given by  

	V(x, y) = \(\(F' \((w)\)\)\&_\  = \ \(\(a\  + \ i\ b\)\&_\  = \ a\  - \ i\ b\)\).  

Since  F (z)  =  a x - 
            b y + i (b x + a y)  =  ϕ (x, 
                y) + i ψ (x, y),  the streamlines are parallel lines given by the equation  ψ (x, y) = (Subscript[K, 1])  which are explicitly given by  b x + a y = c  where  c  is a constant.  They are inclined at an angle  α = - arctan ((b/a)).

Example 10.23,  Page 437.  Consider the complex potential  F[z] = (A/2) (z^2)  where  A  is a positive real number.  The velocity potential and stream function are given by

\(u[x, y] = \(A\/2\) \((x\^2 - y\^2)\), 

      v[x, y] = A\ x\ \(\(y\)\(\ \)\(.\)\)\)

Solution 10.23.

Enter the complex potential and determine the velocity potential and stream function.

Remove[A, x, y, u, v, w, 
        z]; 
Clear[f, g, F]; 
F[z_]  =  (A/2) (z^2); 
u[x_, y_]  =  
        ComplexExpand[
          (A/2) Re[(((x  +  I y))^2)]]; 
v[x_, y_]  =  
        ComplexExpand[
          (A/2) Im[(((x  +  I y))^2)]]; 
Print["The  complex potential is   F[z] = ", F[z]]; 
Print["The velocity potential is u[x,y] = ", 
        u[x, y]]; 
Print["The   stream function  is v[x,y] = ", 
        v[x, y]];

Use Mathematica to make a plot of the stream function.

For illustration purposes, we choose A = 1.

A = 1; 
cont  =  Table[(((0.2  k))^2), {k, 0, 10}]; 
ContourPlot[
        v[x, y], {x, 0, 2}, {y, 0, 2}, 
Contours  -> 
          cont, PlotPoints -> 55, 
        AspectRatio -> 1, 
ColorFunction -> 
          Hue]; 
Print["Contour plot for"]; 
Print["v[x,y] = ", v[x, y]]; 
Print[""]; 
Print[v[x, y] == c]; 
Print["where  c = ", cont];

The inverse of  w  =  f[z] = (z^2)  is  z  =  g[w]  =  (Sqrt[w]).  Use conformal mapping  z = g(w)  to make an image of the flow.

g[w_]  =  (Sqrt[w]); 
Iden[w_]  =  w; 
CartesianMap[Iden, {-4, 4, 0.4}, {0, 4, 0.4}, 
        AspectRatio -> (1/2), 
        Ticks -> {Range[-4, 4, 1], Range[0, 4, 1]}, 
        PlotRange -> {{-4, 4}, {0, 4}}, 
        AxesLabel -> {"u", "v"}, 
        PlotStyle -> {Pink, Magenta}];  
Print["The horizontal flow in the z-plane."]; 
CartesianMap[g, {-4, 4, 0.4}, {0, 4, 0.4}, AspectRatio -> 1, 
        Ticks -> {Range[-3, 3, 1], Range[0, 3, 1]}, 
        PlotRange -> {{0, 2}, {0, 2}}, 
        AxesLabel -> {"x", "y"}, 
        PlotStyle -> {Pink, Magenta}];  
Print["The image flow in the first quadrant,"]; 
Print["under the mapping z = g(w) = ", 
        g[w]]; 
Print[""]; 
Print["Velocity  potential u[x,y] = ", u[x, y]]; 
Print["Stream   function   v[x,y] = ", 
        v[x, y]];

Example 10.24,  Page 437.  Find the complex potential for an ideal fluid flowing from left to right across the complex plane and around the unit circle  |z| = 1.

Solution 10.24.

Consider the complex potential  F[z] = A (z + (1/z)) where  A  is a positive real number.  The velocity potential and stream function are given by  
\(u[x, y] = A\ \((x + x\/\(x\^2 + y\^2\))\), 

      v[x, y] = A\ \(\((y - y\/\(x\^2 + y\^2\))\)\(.\)\)\)  
Enter the complex potential and determine the velocity potential and stream function.

Remove[A, x, y, u, v, w, z, 
        Z]; 
Clear[cont, f, F, g, g1, g2, solset]; 
F[z_]  = A (z  +  (1/z)); 
u[x_, y_]  =  
        ComplexExpand[Re[F[x + I y]], 
          TargetFunctions -> {Re, Im}]; 
v[x_, y_]  = 
        ComplexExpand[Im[F[x + I y]], 
          TargetFunctions -> {Re, Im}]; 
Print["The  complex potential is   F[z] = ", F[z]]; 
Print["The velocity potential is u[x,y] = ", 
        u[x, y]]; 
Print["The   stream function  is v[x,y] = ", 
        v[x, y]];

Use Mathematica to make a plot of the stream function.

For illustration purposes, we choose A = 1.

A = 1; 
cont  =  Table[0 + 0.2  k, {k, 0, 7}]; 
ContourPlot[
        v[x, y], {x, -2, 2}, {y, 0, 
          2}, 
Contours  -> cont, 
        PlotPoints -> 55, 
        AspectRatio -> (1/2), 
ColorFunction -> 
          Hue]; 
Print["Contour plot for"]; 
Print["v[x,y] = ", v[x, y]]; 
Print[""]; 
Print[v[x, y] == c]; 
Print["where  c = ", cont];

The inverse of  \(w = \(f \((z)\) = \(z + 
              1\/z\ \ is\ \ z = \(g \((w)\) = \ \(w\  + \ \@\(w\^2\  - \ 4\)\)\/2\)\)\)\).

\(
\(f[z_]\  = \ z\  + \ 1\/z;\)\ \)
solset  =  Solve[w == f[z], z]; 
g[w_]  =  
        (Subscript[solset, [[2, 1, 2]]]); 
(Subscript[Z, 0])  =  PowerExpand[ExpandAll[g[f[z]]]]; 
(Subscript[Z, 1])  = 
        ReplaceAll[
          (Subscript[Z, 0]) , (Sqrt[1 - 2 (z^2) + (z^4)])  ->  -(1 - 
                  (z^2))]; 
(Subscript[Z, 2])  =  Together[(Subscript[Z, 1])]; 
(Subscript[Z, 3]) = MapAll[Factor, (Subscript[Z, 2])]; 
(Subscript[Z, 4]) = ((1 + (z^2) + (Sqrt[(((-1 + z))^2) (((1 + z))^2)]))/(2 z)); 
(Subscript[Z, 5]) = PowerExpand[(Subscript[Z, 4])]; 
(Subscript[Z, 6]) = Simplify[(Subscript[Z, 5])]; 
Print["f[z] = ", f[z]]; 
Print["g[w] = ", g[w]]; 
Print[" "]; 
Print["g[f[z]] = ", (Subscript[Z, 0])]; 
Print["g[f[z]] = ", (Subscript[Z, 1])]; 
Print["g[f[z]] = ", (Subscript[Z, 2])]; 
Print["g[f[z]] = ", (Subscript[Z, 3])]; 
Print["g[f[z]] = ", (Subscript[Z, 4])]; 
Print["g[f[z]] = ", (Subscript[Z, 5])]; 
Print["g[f[z]] = ", (Subscript[Z, 6])]; 
Print[" "]; 
Print["f[g[w]] = ", f[g[w]]]; 
Print["f[g[w]] = ", 
        Together[f[g[w]]]];

Use conformal mapping  z = g(w)  to make an image of the flow.

\(
\(g1[w_]\  = \ \ \(w\  + \ \@\(w\^2\  - \ 4\)\)\/2;\)\ \)
g2[
          w_]  =   ((w  -  (Sqrt[(w^2)  -  4]))/2); 
Iden[w_]  =  w; 
 CartesianMap[Iden, {-3.2, 3.2, 0.2}, {0, 1.2, 0.2}, 
        AxesLabel -> {"u", "v"}, 
        Ticks -> {Range[-3, 3, 1], Range[0, 2, 1]}, 
        PlotStyle -> {DarkGreen, 
            Green}];  
Print["The horizontal flow in the z-plane."]; 
gr1  =  
        CartesianMap[g1, {0.00001, 3.20001, 0.2}, {0.00001, 1.20001, 0.2}, 
          AxesLabel -> {"x", "y"}, 
          PlotStyle -> {DarkGreen, Green}, 
          DisplayFunction -> Identity];  
gr2  =  
        CartesianMap[
          g2, {-3.20001, -0.00001, 0.2}, { 0.00001, 1.20001, 0.2}, 
          AxesLabel -> {"x", "y"}, 
          PlotStyle -> {DarkGreen, Green}, 
          DisplayFunction -> Identity];  
Show[gr1, gr2, PlotRange -> {{-3, 3}, {0, 2}}, 
        Ticks -> {Range[-3, 3, 1], Range[0, 2, 1]}, 
        DisplayFunction -> $DisplayFunction]; 
Print["The image flow across the complex plane,"]; 
Print["and around the unit circle |z| = 1,"]; 
Print["under the mapping z = g(w) = ", 
        g1[w]]; 
Print[""]; 
Print["Velocity  potential u[x,y] = ", u[x, y]]; 
Print["Stream   function   v[x,y] = ", 
        v[x, y]];

Example 10.25,  Page 438.  Consider the complex potential  F[z] = A (Sqrt[ (z^2) + 1])  for an ideal fluid flowing from left to right across the complex plane slit along the segment from  z = -i  to  z = -i.

Solution 10.25.

Enter the complex potential and determine the velocity potential and stream function.

Remove[A, x, y, u, v, 
        z]; 
Clear[cont, f, F, g1, g2]; 
F[z_]  =  A (Sqrt[ (z^2)  +  1]); 
u[x_, y_]  =  
        ComplexExpand[Re[F[x + I y]], 
          TargetFunctions -> {Re,  Im,  }]; 
v[x_, y_]  =  
        ComplexExpand[Im[F[x + I y]], 
          TargetFunctions -> {Re,  Im,  }]; 
Print["The  complex potential is   F[z] = ", F[z]]
Print["The velocity potential is u[x,y] = "]; 
Print[u[x, y]]; 
Print["The   stream function  is v[x,y] = "]; 
Print[v[x, y]];

Use Mathematica to make a plot of the stream function.

For illustration purposes, we choose A = 1.

A = 1; 
cont  =  Table[0 + 0.1  k, {k, 0, 14}]; 
gr1 = 
        ContourPlot[
          v[x, y], {x, 0.000001, 2}, {y, 0, 
            1.8}, 
Contours  -> cont, 
          PlotPoints -> 25, 
          AspectRatio -> 0.9, 
ColorFunction -> 
            Hue, DisplayFunction -> 
            Identity]; 
gr2 = 
        ContourPlot[-v[x, y], {x, -2, -0.000001}, {y, 0, 
            1.8}, 
Contours  -> cont, 
          PlotPoints -> 25, 
          AspectRatio -> 0.9, 
ColorFunction -> 
            Hue, DisplayFunction -> 
            Identity]; 
Show[gr1, gr2, AspectRatio -> 0.45, 
        DisplayFunction -> $DisplayFunction]; 
Print["Contour plot for"]; 
Print["v[x,y] = ", v[x, y]];  
Print[""]; 
Print[v[x, y] == c]; 
Print["where c = ", cont];

The inverse of  w = f[
            z] = (Sqrt[(z^2) + 1])  is  z = g[
                w] = (Sqrt[(w^2) - 1]).  Use conformal mapping  z = g(w)  to make an image of the flow.

\(
\(g1[w_]\  = \ \ \@\(w\^2\  - \ 1\);\)\ \)
g2[w_]  =  -(Sqrt[(w^2)  -  1]); 
Iden[w_]  =  w; 
CartesianMap[
        Iden, {-2.2, 2.2, 0.1}, {0, 1, 
          0.1}, 
AxesLabel -> {"u", "v"}, 
        PlotStyle -> {Blue, Cyan}]; 
Print["The horizontal flow in the z-plane."]; 
gr1  =  
        CartesianMap[g1, {0.00001, 2.20001, 0.1}, {0.00001, 1.00001, 0.1}, 
          AxesLabel -> {"x", "y"}, 
          PlotStyle -> {Blue, Cyan}, 
          DisplayFunction -> Identity]; 
gr2  =  
        CartesianMap[
          g2, {-2.20001, -0.00001, 0.1}, { 0.00001, 1.00001, 0.1}, 
          AxesLabel -> {"x", "y"}, 
          PlotStyle -> {Blue, Cyan}, 
          DisplayFunction -> Identity]; 
Show[gr1, gr2, PlotRange -> {{-2.05, 2.05}, {0, 1.5}}, 
        Ticks -> {Range[-2, 2, 1], Range[0, 2, 1]}, 
        DisplayFunction -> $DisplayFunction]; 
Print["The image flow across the complex plane,"]; 
Print["slit along the segment from z=-\[ImaginaryI] to z=-\
\[ImaginaryI],"]; 
Print["under the mapping z = g(w) = ", 
        g1[w]]; 
Print[""]; 
Print["The velocity potential is"]; 
Print["u[x,y] = ", u[x, y]]; 
Print[""]; 
Print["The stream function is"]; 
Print["v[x,y] = ", v[x, y]];

Section 10.7  Exercises for Two-Dimensional Fluid Flow
See textbook page 357.

Library Research Experience for Undergraduates

Project I. Write a report on fluid flow and how it is related to harmonic and analytic functions.

1. Denson, Lee A. and Dick K. P. Yue, (1989), ''Computer-Assisted Teaching of marine Hydrodynamics,'' Computers Educ. Vol. 13, No. 3, pp. 279-303.

2. Garabedian, P. R., Edward McLeod and Martin Vitousek ''Recent Advances at Stanford in the Application of Conformal Mapping to Hydrodynamics,'' Am. Math. M., Vol. 61, No. 7, Part 2: Proceedings of the Symposium on Special Topics in Applied Math.. (Aug. - Sep., 1954), pp. 8-10, Jstor.   

3. Halsey, N. D., (1987), Use of Conformal Mapping in Grid Generation for Complex Three-Dimensional Configurations, Am. Inst. of Aeronautics and Astronautics J., V. 25, No. 10, pp. 1286-1291.

4. Harlow, F. H., ''Numerical Fluid Dynamics,'' Am. Math. M., Vol. 72, No. 2, Part 2: Computers and Computing. (Feb., 1965), pp. 84-91, Jstor.   

5. Kranc, S. C., (1986), ''Plotting Streamlines and Pathlines on a Microcomputer,'' Comp. in Ed. Div. of ASEE, V. VI, No. 3, pp. 20-21.

6. Luchini, Paolo and Fernando Manzo, (1989), ''Flow Around Simply and Multiply Connected Bodies: a New Iterative Scheme for Conformal Mapping,'' Am. Inst. of Aeronautics and Astronautics J., V. 27, No. 3, pp. 345-351.

7. Newton, Tyre and Thomas Lofaro, ''On Using Flows to Visualize Functions of a Complex Variable,'' Math. Mag., Vol. 69, No. 1, Feb. 1996.

8. Van Der Veer, P. (1978), ''Exact Solutions for Two-Dimensional Groundwater Flow Problems Involving a Semi-Pervious Boundary,'' J. of Hydrology, Vol. 37, pp. 159-168.

9. Williams, P. Stephen, Steven B. Giddings, and J. Calvin Giddings, (1986), ''Calculation of Flow Properties and End Effects in Field-Flow Fractionation Channels by a Conformal Mapping Procedure,'' Analytical Chemistry, V. 58, No. 12, pp. 2397-2403.

Section 10.7  Exercises for Two Dimensional Fluid Flow
See textbook page 440.

Section 10.8	The Joukowski Airfoil

Section 10.9	The Schwarz-Christoffel Transformation

Section 10.10	Image of a Fluid Flow

Section 10.11	Sources and Sinks

GO TO  THE  Table of Contents