# How to make the plot of potential and force (complex potential)

I want to plot a complex potential

(potential of a pair of source lines)

where c is center, K is constant(amount of change), p is potential, y is psi.

And when I tried, set any constant at c and k

(ex. c=1,k=2)

p1:=K Log[z-c]
p2:=-k Log[z+c]
p:=p1+p2
y1:=k Arg[z-c]
y2:=-k Arg[z-c]
y:=y1+y2


Since, the complex potential is

F(z)=p + I y


There is figure that I want to make Equipotential lines and lines of force (dashed)

Please tell me the method of plotting the complex potential.

Here is a function that plots real and imaginary parts with options that you can set to match your desired size and colors:

Options[fieldPlot] = {"xMax" -> 1, "yMax" -> 1, Contours -> 20,
"FieldLines" -> 20,
"FieldLineStyle" -> Directive[Thick, Dashed, Darker[Cyan]],
"PotentialStyle" -> {Directive[Thick, Darker[Cyan]]},
ExclusionsStyle -> None, Exclusions -> None};

fieldPlot[g_, opts : OptionsPattern[]] := Module[{im, re, xM, yM},
xM = OptionValue["xMax"];
yM = OptionValue["yMax"];
im = ContourPlot[
Im[g[x + I y]],
{x, -xM, xM}, {y, -yM, yM},
ContourStyle -> OptionValue["FieldLineStyle"],
Contours -> OptionValue["FieldLines"]
];
re = ContourPlot[
Re[g[x + I y]],
{x, -xM, xM}, {y, -yM, yM},
FrameLabel -> {"Re(z)", "Im(z)"},
ContourStyle -> OptionValue["PotentialStyle"],
Contours -> OptionValue[Contours],
Exclusions -> OptionValue[Exclusions],
ExclusionsStyle -> OptionValue[ExclusionsStyle]];
Show[re, im, Background -> LightBlue, Frame -> None,AspectRatio->Automatic]]

f[z_] := Log[z - 1] - Log[z + 1]

fieldPlot[f, "xMax" -> 2, "yMax" -> 1] I simplified your function to Log[z - 1] - Log[z + 1] in order to make the plot., because the definitions in the question had typos.

• Perfectly,but why use string as a option name?
– yode
Oct 27 '16 at 12:27
• @yode It's not necessary in principle, but strings are safer because they can't be assigned values. If you use an unprotected symbol name for an option, it can lead to confusion if that symbol has a value.
– Jens
Oct 27 '16 at 15:19