3

Here's what I need to do enter image description here

There are field lines (solid) and lines of the same potential (dashed), these lines are mutually perpendicular.

\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.markings}

\begin{document}

\begin{tikzpicture}[>=latex, decoration={markings, mark=at position 0.6 with 
{\arrow{>}}}]
\foreach \i in {1,...,5}
{
    \draw[rotate = {-10*\i}, postaction={decorate}, smooth] (0,0) 
    ++(135:{0.5*\i}) arc 
    (135:180:{0.5*\i});
    
}
\end{tikzpicture}

\end{document}
1
  • 2
    This sounds like a math question. Yes, it is possible, you just need to figure out what the paths would be. If you don't know their paths, it will be interesting … Commented Sep 4 at 15:01

1 Answer 1

9

It can be done in many ways, and is more of a math question than a LaTeX question. Dipole field lines and equipotential lines are perpendicular.

\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}[
declare function={
equipotentialr=sqrt(\constant*cos(\equipotentialtheta));
equipotentialx=equipotentialr*cos(\equipotentialtheta);
equipotentialy=equipotentialr*sin(\equipotentialtheta);
fieldr=\rzero*sin(\fieldtheta)^2;
fieldx=fieldr*cos(\fieldtheta);
fieldy=fieldr*sin(\fieldtheta);
}]
\begin{axis}[
axis equal,
axis lines=none,
]
\foreach \constant in {5,10,...,50}
\addplot[
blue,
domain=-90:90, samples=50, variable=\equipotentialtheta,
smooth,
] (equipotentialx,equipotentialy);
\foreach \constant in {5,10,...,50}
\addplot[
blue,
domain=-90:90, samples=50, variable=\equipotentialtheta,
smooth,
] (-equipotentialx,equipotentialy);
\foreach \rzero in {1,...,8}
\addplot[
red,
domain=0:360, samples=50, variable=\fieldtheta,
smooth,
] (fieldx,fieldy);
\end{axis}
\end{tikzpicture}
\end{document}

Red and blue field and equipotential lines of a dipole

Selecting a suitable section gives:

\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}[
declare function={
equipotentialr=sqrt(\constant*cos(\equipotentialtheta));
equipotentialx=equipotentialr*cos(\equipotentialtheta);
equipotentialy=equipotentialr*sin(\equipotentialtheta);
fieldr=\rzero*sin(\fieldtheta)^2;
fieldx=fieldr*cos(\fieldtheta);
fieldy=fieldr*sin(\fieldtheta);
}]
\begin{axis}[
axis equal,
axis lines=none,
ymin=0, ymax=1.8,
enlargelimits=false,
]
\foreach \constant in {1,...,8}
\addplot[
domain=15:70, samples=50, variable=\equipotentialtheta,
smooth,
] (-equipotentialx,equipotentialy);
\foreach \rzero in {2,4,...,10}
\addplot[
dashed,
domain=100:165, samples=50, variable=\fieldtheta,
smooth,
] (fieldx,fieldy);
\end{axis}
\end{tikzpicture}
\end{document}

Perpendicular curves and dashed curves

A better section and spacing can be done by setting the domain and constants individual for each line.

Edit: Better section and spacing and without PGFPlots

\documentclass[tikz, border=1cm]{standalone}
\begin{document}
\begin{tikzpicture}[
scale=3,
declare function={
equipotentialr=sqrt(\constant*cos(\equipotentialtheta));
equipotentialx=equipotentialr*cos(\equipotentialtheta);
equipotentialy=equipotentialr*sin(\equipotentialtheta);
fieldr=\rzero*sin(\fieldtheta)^2;
fieldx=fieldr*cos(\fieldtheta);
fieldy=fieldr*sin(\fieldtheta);
}]
\pgfmathsetmacro{\constant}{0.7}
\clip (0,0) rectangle (-3.5,2.5) plot[domain=0:90, samples=50, variable=\equipotentialtheta, smooth] (-equipotentialx,equipotentialy) ;
\pgfmathsetmacro{\constant}{12}
\clip plot[domain=0:90, samples=50, variable=\equipotentialtheta, smooth] (-equipotentialx,equipotentialy);
\pgfmathsetmacro{\rzero}{1.8}
\clip (0,0) rectangle (-3.5,2.5) plot[domain=180:90, samples=50, variable=\fieldtheta, smooth] (fieldx,fieldy);
\pgfmathsetmacro{\rzero}{30}
\clip (-3.5,2.5) -- plot[domain=160:180, samples=50, variable=\fieldtheta, smooth] (fieldx,fieldy) |-cycle;
\pgfmathsetmacro{\constant}{1}
\draw plot[domain=0:90, samples=50, variable=\equipotentialtheta, smooth] (-equipotentialx,equipotentialy);
\pgfmathsetmacro{\constant}{1.3}
\draw plot[domain=0:90, samples=50, variable=\equipotentialtheta, smooth] (-equipotentialx,equipotentialy);
\pgfmathsetmacro{\constant}{1.8}
\draw plot[domain=0:90, samples=50, variable=\equipotentialtheta, smooth] (-equipotentialx,equipotentialy);
\pgfmathsetmacro{\constant}{2.5}
\draw plot[domain=0:90, samples=50, variable=\equipotentialtheta, smooth] (-equipotentialx,equipotentialy);
\pgfmathsetmacro{\constant}{3.5}
\draw plot[domain=0:90, samples=50, variable=\equipotentialtheta, smooth] (-equipotentialx,equipotentialy);
\pgfmathsetmacro{\constant}{5}
\draw plot[domain=0:90, samples=50, variable=\equipotentialtheta, smooth] (-equipotentialx,equipotentialy);
\pgfmathsetmacro{\constant}{7}
\draw plot[domain=0:90, samples=50, variable=\equipotentialtheta, smooth] (-equipotentialx,equipotentialy);
\pgfmathsetmacro{\constant}{10.2}
\draw plot[domain=0:90, samples=50, variable=\equipotentialtheta, smooth] (-equipotentialx,equipotentialy);
\pgfmathsetmacro{\rzero}{2}
\draw[densely dashed] plot[domain=100:180, samples=50, variable=\fieldtheta, smooth] (fieldx,fieldy);
\pgfmathsetmacro{\rzero}{3.2}
\draw[densely dashed] plot[domain=110:180, samples=50, variable=\fieldtheta, smooth] (fieldx,fieldy);
\pgfmathsetmacro{\rzero}{5}
\draw[densely dashed] plot[domain=120:180, samples=50, variable=\fieldtheta, smooth] (fieldx,fieldy);
\pgfmathsetmacro{\rzero}{8}
\draw[densely dashed] plot[domain=140:180, samples=50, variable=\fieldtheta, smooth] (fieldx,fieldy);
\pgfmathsetmacro{\rzero}{16}
\draw[densely dashed] plot[domain=150:180, samples=50, variable=\fieldtheta, smooth] (fieldx,fieldy);
\end{tikzpicture}
\end{document}

Perpendicular solid and dashed curves

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .