# Using TikZ to suggest Mimakon's theorem for a tractrix

For my thesis I would like to make a picture explaining why the area between the tractrix and its asymptote equals that of half a circle. The code I used for the image obtained below is

\begin{minipage}{.45\textwidth}
\begin{center}\begin{tikzpicture}[scale=2.5]
\draw[blue] (-1.2,0) -- (1.2,0) node[right,black] {$x$};
\draw (0,-.2) -- (0,1.2) node[above] {$y$};
\clip (-1.2,-.2) rectangle (1.2,1.2);
\foreach \i in {0,0.05,...,1}{
\draw (0,1) -- ({cos(\i*pi r)},{1-sin(\i*pi r)});
};
\draw (0,1) -- (-1,1);
\draw (1,1) arc (0:-180:1);
\draw[red,thick] plot[parametric,id=tractrix,samples=200,domain=0.03:3.11] function{cos(t)+log(tan(0.5*t)),sin(t)};
\end{tikzpicture}\end{center}
\end{minipage}
\begin{minipage}{.54\textwidth}
\begin{center}\begin{tikzpicture}[scale=2.5]
\draw[blue] (-1.5,0) -- (1.5,0) node[right,black] {$x$};
\draw (0,-.2) -- (0,1.2) node[above] {$y$};
\clip (-1.5,-.2) rectangle (1.5,1.2);
\foreach \i in {0,0.05,...,1}{
\draw (0,1) -- ({cos(\i*pi r)},{1-sin(\i*pi r)});
};
\draw (0,1) -- (-1,1);
\draw (1,1) arc (0:-180:1);
\draw[red,thick] plot[parametric,id=tractrix,samples=200,domain=0.03:3.11] function{cos(t)+log(tan(0.5*t)),sin(t)};
\end{tikzpicture}\end{center}
\end{minipage}


Now I would like to change the positions of the circle segments on the right so that they slide down against their neighbors until they touch the x-axis. Then approximately the upper points will follow the tractrix and it will seem plausible that the theorem about the area is correct, without having to integrate anything.

The problem is I don't know how to fit this into a nice for-loop since the (recursive) calculation of the coordinates seems complicated. The result I would like to achieve looks like the following on Wolfram Demonstration Projects:

Is this possible? As a bonus, it would be cool if I could make the time intervals either smaller or bigger to obtain the best' image, or even add a gradient of some sort. Thanks in advance!

P.S.: this is my first question of tex.stackexchange, so hopefully I provided enough information. If not, please let me know.

A bit of reworking of the original answer (see the the edit history for a recursive approach), but essentially the idea is to let the coordinate transformation matrix do all the work.

\pgfmathloop is used as it does not install a TeX scope allowing transforms to survive each iteration. At each iteration a rotation is applied, and a shift is applied to move the next slice the appropriate distance.

pgfplots is used here simply for the colormaps and color of colormap key.

\documentclass[tikz,border=5]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{colormaps}
\pgfplotsset{compat=1.14}
\newcommand\mimakon[3][-1]{%
% #1 - (optional) number of slices to shift/translate
% #2 - total number of slices
% #3 - colormap name
\begin{scope}
\pgfplotsset{colormap/#3}%
\pgfmathsetmacro\s{90/#2}%
\pgfmathsetmacro\N{#2}
\pgfmathsetmacro\n{int(#1 < 0 ? \N : #1)}
\tikzset{shift={(0,1)}}
\foreach \k in {-1,1}{%
\pgfmathloop
\ifnum\pgfmathcounter>\N
\else
\let\i=\pgfmathcounter
\pgfmathsetmacro\c{\i/\N*1000}
\fill [color of colormap=\c] (0,0) -- (270:1) arc (270:270+\s*\k:1) -- cycle;
\tikzset{rotate=\s*\k}
\ifnum\i>\n
\else
\pgfmathsetmacro\a{cos((\i-1)*\s)*sec(mod(\i*\s, 90) == 0 ? 0 : \i*\s) - 1}
\tikzset{shift=(270:\a)}
\fi
\repeatpgfmathloop}
\end{scope}}
\begin{document}
\foreach \z in {10,...,0,1,2,...,10}{%
\begin{tikzpicture}[x=2cm,y=2cm]
\useasboundingbox (-3,-.25) (3,1.25);
\mimakon[\z]{10}{cool}
\end{tikzpicture}}
\end{document}


Reusing the definition of \mimakon given above, the tractrix can be drawn on top like this:

\tikzdeclarecoordinatesystem{tractrix}%
{\pgfpointxy{cos(deg(#1))+ln(tan(deg(0.5*#1)))}{sin(deg(#1))}}
\begin{tikzpicture}[x=2cm,y=2cm]
\mimakon{15}{greenyellow}
\draw [red, thick] plot[samples=200, domain=0.03:3.11] (tractrix cs:\x);
\end{tikzpicture}
`

• Thanks a bunch mr. Wibrow, that definitely helped. Will use this kind of method from now on. For example, the theorem is also applicable to the area of a cycloid which I will cover in another part of my thesis. P.S.: that moving image is very addicting to keep looking at. Oct 18 '17 at 18:30