7

enter image description here

I am trying to generate an ellipse which resembles the circle shown here.

Appreciate your help.

I have tried the following code.

\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}[>=latex]

\draw [dashed, line width=0.5pt] (0,0) ellipse (6cm and 4cm);

\foreach \i [evaluate={\a=\i*45-45; \b=\a+22.5; \c=cos(\b)<0; \d=sin(\b)<0;}] in {1,...,8}{
    \draw [line width=0.50pt](\a:3.95) -- (\a:4.05) node [at end, anchor=\a+180] {\i};
    \tikzset{shift=(\b:4)}
    \node [anchor=\b+180, circle, draw, outer sep=1ex] {\i};
    \draw [line width=0.5pt][->](\c*1.5-0.75,0) -- (0,0) node [at start, anchor=180*\c] {$\rho_{x_{\i}}$};
    \draw [line width=0.5pt][->](0,\d*1.5-0.75) -- (0,0) node [at start, anchor=180*\d+90] {$\rho_{y_{\i}}$};
}
\draw [line width=0.50pt](-0.10,0) -- (0.10,0);
\draw [line width=0.50pt](0,-0.10) -- (0,0.10);

\end{tikzpicture}
\end{document}
5
  • 4
    regarding your reputation you should know, that this is question "do-it-for-me", which likely will not be answered ... please show us what you try so far or small complete document by which is drawn showed image.
    – Zarko
    May 17, 2017 at 13:36
  • I'm unable to translate points of arrows and division of ellipse into 8 equal parts.
    – ltxEnthu
    May 17, 2017 at 14:07
  • how are par equals? by area, by locus length, angle? please, be more specific.
    – Zarko
    May 17, 2017 at 14:55
  • Ellipse division, equal area.
    – ltxEnthu
    May 17, 2017 at 15:43
  • 2
    than you have math problem, not LaTeX! you should define relation between angles and areas ... after this come LaTeX and all become simple :)
    – Zarko
    May 17, 2017 at 16:00

2 Answers 2

10

I completely agree with @Zarko - this is more of a mathematical challenge than a LaTeX challenge. But since both fields are dear to me, I think the answer is interesting and I'll take a crack at it. If I understand correctly, you want the same picture, but for an ellipse, where the circumference of the ellipse is divided into 8 pieces of equal length. If that's your goal, take a look at the following pages if you would like more background on this stuff:

I'll assume that's your goal. First, set a to be the half of the width (semi-major axis) and b to be half of the height (semi-minor axis), assuming width is larger than height. Set c to be the circumference of the ellipse, which, using the first link above, is the following integral:

enter image description here

Let t_k be the angle of node k on the outside of your diagram, for k=1,2,...,8. Using the second link above, t_k is given by the following integral:

enter image description here

Now all that is left is to (numerically, probably) evaluate the first and invert the second integral, get the t_k, and plug them into LaTeX. Using Mathematica, paraphrasing from the second link above, we could have something like the code below, if a=5 and b=3:

a = 5;
b = 3; 
c = 4*a*NIntegrate[Sqrt[1 - (1 - b^2/a^2)*Sin[t]^2], {t, 0, Pi/2}];
Theta[a_, b_, s_] := t /. FindRoot[b EllipticE[t, (b^2 - a^2)/b^2] == s, {t, 0}]; 
Table[Theta[a, b, c/16 + k*c/8]*180/Pi, {k, 0, 7}]

Then we throw the elements of the table the above code produces into LaTeX, first only including the arrows pointing at the nodes. The code would be as below:

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}
\draw[dashed] (0,0) ellipse (5 and 3);
\foreach \ang\name in {28.5757/1, 71.5146/2, 108.485/3, 151.424/4, 208.576/5, 251.515/6, 288.485/7, 331.424/8}{
  \coordinate (\name) at ({5*cos(\ang)},{3*sin(\ang)});
}
\foreach \name\da\db in {1/180/270, 2/180/270, 3/270/0, 4/270/0, 5/0/90, 6/0/90, 7/90/180, 8/90/180}{
  \draw[<-] (\name)--++(\da:.5);
  \draw[<-] (\name)--++(\db:.5);
}
\end{tikzpicture}

\end{document}

Note the use of the curly braces {} around the cos and sin functions, without them the code will not compile. I've defined the coordinates first, so the code doesn't get too cluttered. The result looks like this:

enter image description here

Next we add all the bells and whistles to your diagram. For the numbers not in circles, we actually need to run the Mathematica code again to get the angles in between (or I suppose you could just take the difference of two successive angles). For the names of the \rho nodes to work a bit of switching in the \foreach loop also has to happen. Either way, a bit more works needs to be done.

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{calc,arrows.meta}

\begin{document}

\begin{tikzpicture}
\draw[dashed] (0,0) ellipse (5 and 3);
\foreach \ang\name in {28.5757/1, 71.5146/2, 108.485/3, 151.424/4, 208.576/5, 251.515/6, 288.485/7, 331.424/8}{
  \coordinate (\name) at ({5*cos(\ang)},{3*sin(\ang)});
  \node[circle,draw] at ($(\name)+(\ang:.5)$) {\name};
}
\foreach \name\da\db in {1/180/270, 2/180/270, 3/0/270, 4/0/270, 5/0/90, 6/0/90, 7/180/90, 8/180/90}{
  \draw[{Triangle[angle=30:2pt 4]}-] (\name)--++(\da:.5) node[anchor=\da-180] {$\rho_{x_\name}$};
  \draw[{Triangle[angle=30:2pt 4]}-] (\name)--++(\db:.5) node[anchor=\db-180] {$\rho_{y_\name}$};
}
\foreach \ang\name in {0/1, 51.6959/2, 90/3, 128.304/4, 180/5, 231.696/6, 270/7, 308.304/8}{
  \draw ($({5*cos(\ang)},{3*sin(\ang)})+(\ang:.05)$)--++(\ang-180:.1);
  \node at ($({5*cos(\ang)},{3*sin(\ang)})+(\ang:.3)$) {\name};
}
\node at (0,0) {$+$};
\end{tikzpicture}

\end{document}

The result is below. A lot of the parameters, such as length of the arrows, thickness of the arrows tips, size of the \rho nodes (changed with scale=.8 or similar), positioning of the numbered nodes relative to the ellipse can be easily changed, depending on your preference.

enter image description here

2
  • nice elaboration (+1)! math is dear to me too, but for OP problem she/he miss the site :)
    – Zarko
    May 17, 2017 at 19:13
  • @Jānis Lazovskis Hats off folk! I was unable to connect the dots of the problem. You are truely awesome.
    – ltxEnthu
    May 17, 2017 at 21:48
7

If it is dividing the circumference into equal lengths that is required then decorations can provide a reasonable approximation.

\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}[>=stealth]
\draw [dashed,
  preaction={decoration={markings,
    mark=between positions 0.0625 and 1 step 0.125 with { 
      \coordinate (m-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number});
    }
  }, decorate},
  preaction={decoration={markings,
    mark=between positions 0 and 1 step 0.125 with { 
      \coordinate (n-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number});
    }
  }, decorate}] ellipse [x radius=5, y radius=3];
\foreach \i [evaluate={
    \a=157.5+45*\i; \b=135+45*\i;
    \ya=floor((\i-1)/4)*180-90; \xa=floor((\i+1)/4+1)*180;}] 
    in {1,...,8}{
  \node [circle, draw, outer sep=5pt, anchor=\a] at (m-\i) {\i};
    \draw [<-] (m-\i) -- ++(\ya:1/2) node [anchor=\ya+180] {$\rho_{y_{\i}}$};
    \draw [<-] (m-\i) -- ++(\xa:1/2) node [anchor=\xa+180] {$\rho_{x_{\i}}$};
    \draw [shift={(n-\i)}] 
      (\b:-1/16) -- (\b:1/16) node [at end, circle, anchor=\b] {\i};
} 
\draw (180:1/16) -- (0:1/16) (90:1/16) -- (270:1/16);
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

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