本来是不想自问自答的,但是很尴尬的是,最后还是我自己找到了答案,为了防止误导还是作答如下:
那本书的图(也就是题目里面的图)其实是不对的;
将复函数转化为向量场就是求一个复函数的波利亚向量场,在旧版本里面是
(* << VectorFieldPlots` *)
PolyaFieldPlot[f,{x,xmin,xmax},{y,ymin,ymax}]
这个函数已经过期了。相对应的新版本的函数是
VectorPlot[{Re[f],-Im[f]},{x,xmin,xmax},{y,ymin,ymax}, VectorScale -> {Automatic, Automatic, #5^(1/4) &}]
没错,用ReIm其实是不对的。至于是不是#5的1/4次幂还是其他的关于#5的函数尚未确认。
一个复函数对应着一个流,这个流就是该复函数导数的波利亚向量场,复函数的实部是该向量场的势函数,虚部是流函数。势函数的绘制用ContourPlot,流函数用StreamPlot。
它们之间的关系可以用下图给读者参考之:
fn = Tan [x + I*y];
Block[{G1 = VectorPlot[{Re[fn], -Im[fn]},
{x, -2 \[Pi], 2 Pi}, {y, -2 \[Pi], 2 Pi},
VectorScale -> {Automatic, Automatic, #5^(1/4) &}],
G2 = ContourPlot[
Im[fn] - Im[fn]/(Re[fn]^2 + Im[fn]^2), {x, -2 \[Pi],
2 Pi}, {y, -2 \[Pi], 2 Pi}, Contours -> 50,
ContourShading -> None],
G3 = ContourPlot[
Re[fn] + Re[fn]/(Re[fn]^2 + Im[fn]^2), {x, -2 \[Pi],
2 Pi}, {y, -2 \[Pi], 2 Pi}, Contours -> 50,
ContourShading -> None, ContourStyle -> Dashed],
G4 = StreamPlot[{1 - (Re[fn]^2 - Im[fn]^2)/(
Re[fn]^2 + Im[fn]^2), (-Re[fn] Im[fn])/(Re[fn]^2 + Im[fn]^2)},
{x, -2 \[Pi], 2 Pi}, {y, -2 \[Pi], 2 Pi}, StreamPoints -> 200],
G5 = PlotC[Tan[x + I y], -2 \[Pi], 2 \[Pi], -2 \[Pi], 2 \[Pi],
0.05, {Re[z], Im[z]}],
G6 = Plot3D[
Abs[Tan[x + I y]], {x, -2 \[Pi], 2 Pi}, {y, -2 \[Pi], 2 Pi},
ColorFunction -> (Hue[Arg[Tan[#1 + I #2]]/2 \[Pi] + 0.5] &),
AxesLabel -> {Re[x], Im[x], Abs[y]},
ExclusionsStyle -> {Opacity[0.5], Directive[Thick, Blue]},
BoundaryStyle -> Directive[Red, Thick],
PerformanceGoal -> "Quality"]}, {G1, G2, G3, G4, Show[G2, G3],
Show[G3, G4], G5, G6}]
Clear[fn]
PlotC是我自己改编的一个基于RasterArray的函数,原型在wiki上,在mmaqa也用这个函数回答过函数绘图问题。