4

I'd like to do the next graph:

enter image description here

(Sorry for my terrible draw!) I pretend the red line to be a dashed black spiral line, and I'd like the blue line to be a dashed black circular line.

What I've got so far:

\begin{tikzpicture}
\draw [<->] (0,4) node[left]{$ \mbox{Im} (z) $} -- (0,0) -- (4,0) node[below]{$ \mbox{Re} (z) $};
\draw [<->] (1,3)node[right]{$ \alpha z $} -- (0,0) -- (2,1)node[right]{$ z $};
\end{tikzpicture}

Anyone could help me?

  • You might want to take a look at this post if you haven't found it yet: http://tex.stackexchange.com/questions/66490/drawing-a-tikz-arc-specifying-the-center – Paul Rigor May 21 '15 at 02:59

4 Answers4

7

The radius, the start and end angles for the arc command can be calculated, see the following example.

(Update:) For the red "spiral" line I have used the plot function with a polar coordinate. The length of the polar coordinate linearly increases with the angle going from point (z) to (a):

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

\begin{document} \begin{tikzpicture} \draw [<->] (0,4) node[left]{$ \mbox{Im} (z) $} -- (0,0) -- (4,0) node[below]{$ \mbox{Re} (z) $}; \draw [<->] (1,3) coordinate (a) node[above] {$ \alpha z $} -- (0,0) -- (2,1) coordinate (z) node[right] {$ z $};

\draw[blue] let \p{z} = (z), \n{angle_z} = {atan(\y{z}/\x{z})}, \p{a} = (a), \n{angle_a} = {atan(\y{a}/\x{a})}, \n{radius} = {sqrt(\x{z}\x{z} + \y{z}\y{z})} in (z) arc[start angle=\n{angle_z}, end angle=\n{angle_a}, radius=\n{radius}] ;

\draw[red, densely dashed] let \p{z} = (z), \p{a} = (a), \n{zAngle} = {atan2(\y{z}, \x{z})}, \n{aAngle} = {atan2(\y{a}, \x{a})}, \n{diffAngle} = {\n{aAngle} - \n{zAngle}}, \n{zLength} = {sqrt(\x{z}\x{z} + \y{z}\y{z})}, \n{aLength} = {sqrt(\x{a}\x{a} + \y{a}\y{a})}, \n{diffLength} = {\n{aLength} - \n{zLength}} in plot[ smooth, variable=\t, domain=\n{aAngle}:\n{zAngle}, samples=8, ] (\t:{\n{zLength} + \n{diffLength} * (\t - \n{zAngle}) / \n{diffAngle}}) ; \end{tikzpicture} \end{document}

Result

Remark:

The order of arguments for function atan2 has changed in TikZ 3.0: atan2(<y>, <x>). In case of older TikZ versions, <y> and <x> has to be exchanged.

Heiko Oberdiek
  • 271,626
6

A combination of rotation and scaling does the job neatly in Metapost.

enter image description here

prologues := 3;
outputtemplate := "%j%c.eps";

beginfig(1);

path re, im;
re = origin -- right scaled 4cm;
im = re rotated 90;
drawarrow im; label.lft(btex $\mathop{\rm Im}(z)$ etex, point 1 of im);
drawarrow re; label.bot(btex $\mathop{\rm Re}(z)$ etex, point 1 of re);

z1 = (2.828cm,1.414cm);
alpha = 0.3;
theta = 45;

s = 20;
draw z1 for i=1 upto s: -- z1 rotated (theta*i/s)                      endfor withcolor .67 blue;
draw z1 for i=1 upto s: -- z1 rotated (theta*i/s) scaled (1+alpha*i/s) endfor dashed evenly withcolor .73 red;

drawarrow origin -- z1;
drawarrow origin -- z1 scaled (1+alpha) rotated theta;

label.rt (btex $z$ etex, z1);
label.top(btex $\alpha z$ etex, z1 scaled (1+alpha) rotated theta);

endfig;
end.
Thruston
  • 42,268
5

Another try with MetaPost, inspired by Thruston's solution, but using the zscaled operator of MetaPost which is in fact the complex multiplication. Also, I have incorporated it in a LuaLaTeX program, as I use to do.

\documentclass[border=2mm]{standalone}
\usepackage{luamplib, amsmath}
\begin{document}
  \begin{mplibcode}
    beginfig(1);
      r = 1.3; theta = 45;
      z = (2.828cm,1.414cm);
      pair alpha, alphaz, re, im; 
      re = (4cm, 0); im = (0, 4cm);
      alpha = r*dir theta; 
      alphaz = z zscaled alpha;
      for m = re, im, z, alphaz: drawarrow origin -- m; endfor
      s = 20;
      draw z
        for i = 1 upto s: .. z zscaled ((i/s)[1,r]*dir(i/s*theta))
        endfor withcolor .73red dashed evenly;
      draw z
        for i = 1 upto s: .. z rotated (i/s*theta)
        endfor withcolor .67blue;
      label.bot(btex $\text{Re}(z)$ etex, re);
      label.lft(btex $\text{Im}(z)$ etex, im);
      label.rt(btex $z$ etex, z);
      label.top(btex $\alpha z$ etex, alphaz);
    endfig;
  \end{mplibcode}
\end{document}

enter image description here

Franck Pastor
  • 18,756
3

Here is a short code for an Archimedean spiral between two points (the equation was calculated) with pstricks:

\documentclass[pdf, x11names]{standalone}
\usepackage{pstricks-add}
\usepackage{amsmath}
\DeclareMathOperator\re{Re}
\DeclareMathOperator\im{Im}
\def\Pi#1{\ifcase#1\or3.141593\or1.570796\or1.047198\or0.785398\or0.628319\or0.523599\or0.448799\0.392699\or0.349066\fi}

\begin{document}

\begin{pspicture} $
    \psset{ticks=none, labels=none, arrowinset=0.2,arrows =c->, labelsep=3pt}
    \psaxes{c->}(0,0)(4.6,4.6)[\re (z),-90][\im (z),180]
    \pnodes(0,0){O}(2.8;30){Z}(4.6;60){T}
    \uput[r](T){\alpha z}\uput[r](Z){z}
    \ncline{O}{T} \ncline{O}{Z}
    \psset{linewidth =0.6pt}
    \psarc[linecolor=LightSteelBlue3,dimen=inner](O){2.8}{31}{60}
    \psplot[linecolor=Tomato3, polarplot, algebraic, plotpoints=200]{\Pi6}{\Pi3}{10.8*x/Pi + 1}%
    $\end{pspicture}

\end{document} 

enter image description here

Bernard
  • 271,350