# Complex function plot using TikZ or PGFPlots

I need to plot some steps of this approximation https://mathoverflow.net/a/27127 but don't know how to start.

• Welcome to TeX.SE. Have you looked in the manual of either package? There are examples of how to plot functions, tables of data etc. Please be more specific on what exactly you have problems with. (note that complex functions are nothing but the x-axis as the real part of the function, and the y-axis as the complex part of the function, if this is one of the problems?) – zeroth Nov 24 '14 at 17:22
• That looks like it was created with the computer algebra system Sage using the animate command – DJP Nov 24 '14 at 17:31
• I don't need an animated version and I'm pretty familiar with TikZ and complex numbers, but at the moment I don't have any idea how to plot e.g. N = 3 case. – GeMir Nov 24 '14 at 17:40

Fixed the exponent typo now it is behaving properly.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}
\draw[style=help lines] (-1.5,0) grid[step=1] (1.5,1.5);
\node[fill,circle,inner sep=0.5pt] (one) at (1,0) {};
\node[fill,circle,inner sep=0.5pt] (i) at (0,1) {};
\pgfmathsetmacro\myfactor{1cm/1pt} % Pff.. pt causes arithmetic overflow

\foreach \k in {1,...,100}{
\draw[opacity=1/\k] (1,0) let
\p1=($(one)+([scale=pi/\k]i)$),
\n1 = {veclen(\x1,\y1)/\myfactor},\n2 = {atan2(\y1,\x1)}
in\foreach \l in {1,...,\k}{-- ($({\l*\n2}:{(\n1^\l)*1cm})$)};
}
\end{tikzpicture}
\end{document}


• Looks like something I can start with, even if it doesn't compile. Thank you. – GeMir Nov 24 '14 at 18:41
• Line 17: ! Package tikz Error: + or - expected. – GeMir Nov 24 '14 at 18:48
• Updated to 3.0 and it works well. Thank you! – GeMir Nov 25 '14 at 1:04
• @GeMir My pleasure. – percusse Nov 25 '14 at 1:41