Equipotential Curves and Streamlines

Let's consider a potential function along with its equipotential curves and the streamlines of the gradient field of the potential.

In[21]:=

  Clear[pot,v,x,y,z]
  pot[x_,y_]:=x y

In[22]:=

  v=grad2[pot][x,y]

Out[22]=

  {y, x}

Plot the equipotential curves xy=c.

In[23]:=

  equipot=ContourPlot[pot[x,y],{x,-5,5},{y,-5,5}, ContourShading->False,
  ContourStyle->Dashing[{.02}],AspectRatio->Automatic];

Find the streamlines.

In[24]:=

  Clear[x,y]
  DSolve[x'[t]/y[t]==y'[t]/x[t],y[t],t]

Out[24]=

                             2
  {{y[t] -> -Sqrt[C[1] + x[t] ]}, 
   
                             2
    {y[t] -> Sqrt[C[1] + x[t] ]}}

In[25]:=

  Clear[x,y];
  DSolve[{x'[t]/y[t]==y'[t]/x[t]},y,t];
  y=Evaluate[y[t]/.Flatten[%][[1]]]/.x[t]->x;
  y

Out[25]=

         2
  -Sqrt[x  + C[1]]

So . . .

y=-Sqrt[x^2+c]. This implies y^2=x^2+c or
x^2-y^2=c

In[26]:=

  stream=ContourPlot[x^2-y^2,{x,-5,5},{y,-5,5},ContourShading->False,
  AspectRatio->Automatic];

In[27]:=

  Show[equipot,stream];

Notice anything?

Let's look at another one.

Consider the gradient field {2xy,x^2-y^2}. Does it come from a potential? If so, what is the potential?

Consider the gradient field {2xy,x^2-y^2}. Does it ...

In[35]:=

  Clear[equipot,stream]
  equipot=ContourPlot[pot[x,y],{x,-5,5},{y,-5,5}, ContourShading->False,
  ContourStyle->Dashing[{.02}],AspectRatio->Automatic];

Let's find streamlines. Let's help Mathematica out by separating the variables.

In[36]:=

  Clear[x,y]
  DSolve[x'[t]/x[t]==2 y'[t] y[t]/(x[t]^2-y[t]^2),y[t],t]

Out[36]=

                             3
                         x[t]
                  C[1] + -----
                           3
  {{y[t] -> -Sqrt[------------]}, 
                      x[t]
   
                             3
                         x[t]
                  C[1] + -----
                           3
    {y[t] -> Sqrt[------------]}}
                      x[t]

In[37]:=

  Clear[x,y]
  DSolve[{x'[t]/x[t]==2 y'[t] y[t]/(x[t]^2-y[t]^2)},y,t];
  y=Evaluate[y[t]/.Flatten[%][[1]]]/.x[t]->x;
  y

Out[37]=

         3
        x
        -- + C[1]
        3
  -Sqrt[---------]
            x

So . . .

y=-Sqrt[(1/3 x^3+c)/x]. This implies y^2=1/3 x^2+c/x or
1/3 x^2-y^2+c/x=0. Multiply through by x:
1/3 x^3-xy^2=c

In[38]:=

  Clear[x,y]
  stream=ContourPlot[1/3 x^3-x y^2,{x,-5,5},{y,-5,5},ContourShading->False,
  AspectRatio->Automatic];

In[39]:=

  Show[equipot,stream];

Notice anything yet? Look closer at the "straighter" parts.

Notice anything yet? Look closer at the ...

Up to Potential Flow in Two Dimensions