3.3 正則関数の定める流れを Mathematica で可視化

複素数の計算、$ 2$ 変数関数の等高線と2次元ベクトル場の描画が出来れば良い。


虚数単位は I, 実部 Re[ ], 虚部 Im[ ], 共役複素数 Conjugate[ ], 絶対値 Abs[ ], 偏角(の主値) Arg[ ], 式の中のすべての変数を実数と仮定して実部・虚部に展開する ComplexExpand[ ] などが用意されている。

2変数関数の等高線の描画には ContourPlot[ ], ベクトル場の描画には VectorPlot[ ] が用意されている。 これらの使い方はオンライン・ヘルプを見よ (例えば ?ContourPlot)。

「応用複素関数」 に、uniformflow.nb source.nb というサンプル・プログラムを用意してある (保存してから Mathematica で開くこと)。

$ c=1-2i$ の場合の $ f(z)=cz$ を複素速度ポテンシャルとする流れ
c=1-2I;
f[z_]:=c z;
ComplexExpand[f[x+I y]]
phi[x_,y_]:=ComplexExpand[Re[f[x+I y]]];
psi[x_,y_]:=ComplexExpand[Im[f[x+I y]]];

phi[x,y]

psi[x,y]

g1=ContourPlot[phi[x,y]==Table[c,{c,-5,5,1.0}],{x,-2,2},{y,-2,2},
  ContourStyle->Directive[Red,Thin]]

g2=ContourPlot[psi[x,y]==Table[c,{c,-5,5,1.0}],{x,-2,2},{y,-2,2},
  ContourStyle->Directive[Blue,Thin]]

u[x_, y_] := ComplexExpand[Re[f'[x + I y]]];
v[x_, y_] := -ComplexExpand[Im[f'[x + I y]]];

g3 = VectorPlot[{u[x, y], v[x, y]}, {x, -2, 2}, {y, -2, 2}]

g12=Show[g1,g2]

g13=Show[g1,g3]

ComplexExpand[ ] は、 事前に Evaluate させる効果も考えて採用したが、 いつもこれを使うのが良いかは分からない。

図 4: 等ポテンシャル線と流線は直交する
\includegraphics[width=6cm]{image/phipsi.eps}
図 5: 等ポテンシャル線と速度ベクトル
\includegraphics[width=6cm]{image/potentialandvelocity.eps}

このように、一様流は素直なので簡単に描画できるが、 そうでないものは色々調整が必要になったりする (湧き出しの場合の source.nb が参考になるかも)。

桂田 祐史
2017-08-11