Aside on Complex Functions

Consider the complex functions u(x,y)=(x+iy)^n. (Note i=Sqrt[-1].) Try Laplace's equation uxx+uyy=0

In[60]:=

  Clear[u]
  u[x_,y_,n_]:=(x+I y)^n

In[61]:=

  D[u[x,y,n],{x,2}]

Out[61]=

                      -2 + n
  (-1 + n) n (x + I y)

In[62]:=

  D[u[x,y,n],{y,2}]

Out[62]=

                        -2 + n
  -((-1 + n) n (x + I y)      )

In[63]:=

  D[u[x,y,n],{x,2}]+D[u[x,y,n],{y,2}]

Out[63]=

  0

So . . .

These functions satisfy Laplace's equation!

What you need to know here about complex functions is that both the real and imaginary parts satisfy Laplace's equation also. For example:

In[64]:=

  ComplexExpand[u[x,y,2]]

Out[64]=

   2              2
  x  + 2 I x y - y

The real part is the part without the i terms; the imaginary part has the i terms.

In[65]:=

  u1=x^2-y^2
  u2=x y

Out[65]=

   2    2
  x  - y

Out[66]=

  x y

In[67]:=

  D[u1,{x,2}]+D[u1,{y,2}]
  D[u2,{x,2}]+D[u2,{y,2}]

Out[67]=

  0

Out[68]=

  0

In[69]:=

  ComplexExpand[u[x,y,3]]

Out[69]=

   3        2         2      3
  x  - 3 x y  + I (3 x  y - y )

The real part is the part without the i terms; the imaginary part has the i terms.

In[70]:=

  u3=x^3-3 x y^2
  u4=3 x^2 y-y^3

Out[70]=

   3        2
  x  - 3 x y

Out[71]=

     2      3
  3 x  y - y

In[72]:=

  D[u3,{x,2}]+D[u3,{y,2}]
  D[u4,{x,2}]+D[u4,{y,2}]

Out[72]=

  0

Out[73]=

  0

If the principle of superposition holds for partial differential equations (if does), we now have an infinite sequence of solutions to Laplace's equation to build from. We will make more use of this later.

The u's above should look familiar. They represent potentials and the associated streamlines we studied above.

Without getting into the complex function theorey involved, if we have u1(x,y)+iu2(x,y) analytic in a domain D (and u(x,y)=(x+iy)^n is), then u1 and u2 are called harmonic and are solutions to Laplace's equation because they satisfy the Cauchy-Riemann equations
D[u1,x] = D[u2,y]
D[u1,y ]= - D[u2,x].

The function u2 is called the harmonic conjugate of u1 and if u1 represents a potential function (with equipotential curves u1=c) then u2 represents the so called "stream function" (with streamlines u2=c).

Notice that with the Cauchy-Riemann equations we can find u2 given a potential u1:
u2(x,y) is the line integral from (x0,y0) to (x,y) of -D[u1,t]ds + D[u1,s]dt (s and t are dummy variables).

Let's look back at the potential u(x,y)=3x^2 y-y^3 (actually we looked at x^2 y-1/3 y^3, a constant multiple).

In[74]:=

  Clear[u,v]
  u[x_,y_]:=3 x^2 y-y^3

The streamlines can be found using what we know from above. Simply find the harmonic conjugate of u, using (x+iy)^n. What n do we need? Since we have y^3, we need n=3.

In[75]:=

  ComplexExpand[(x+I y)^3]

Out[75]=

   3        2         2      3
  x  - 3 x y  + I (3 x  y - y )

The streamlines have to be x^3 - 3xy^2=c, just like we found above (actually, a constant multiple again)

In[76]:=

  Clear[equipot,stream,x,y]
  equipot=ContourPlot[u[x,y],{x,-5,5},{y,-5,5}, ContourShading->False,
  ContourStyle->Dashing[{.02}],AspectRatio->Automatic,DisplayFunction->Identity];
  stream=ContourPlot[x^3-3 x y^2,{x,-5,5},{y,-5,5},ContourShading->False,
  AspectRatio->Automatic,DisplayFunction->Identity];
  

Note: The option DisplayFunction->Identity tells Mathematica not to show the graph. We'll show it when we put the graphs together with the option DisplayFunction->$DisplayFunction.

In[77]:=

  Show[equipot,stream,DisplayFunction->$DisplayFunction];

This works really well for polynomial solutions to Laplace's equation! What about non polynomial solutions? Find the streamlines the way we did above (or take a complex variables course, I guess).

Up to Potential Flow in Two Dimensions