如何在两个矢量之间绘制圆形和螺旋线

如何在两个矢量之间绘制圆形和螺旋线

我想做下一个图表:

在此处输入图片描述

(抱歉我的画得很糟糕!)我把红线当作一条黑色虚线螺旋线,把蓝线当作一条黑色虚线圆形线。

我目前得到的是:

\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}

有人能帮助我吗?

答案1

可以计算命令的半径、起始和终止角度arc,见以下示例。

(更新:)对于红色“螺旋”线,我使用了plot极坐标函数。极坐标的长度随着从点(z)到的角度线性增加(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}

结果

评论:

atan2在 TikZ 3.0 中,函数参数的顺序已发生改变: atan2(<y>, <x>)。对于旧版本的 TikZ,<y><x>必须互换。

答案2

旋转和缩放的组合可以很好地完成工作元帖子

在此处输入图片描述

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.

答案3

再次尝试 MetaPost,灵感来自 Thruston 的解决方案,但使用zscaledMetaPost 的运算符,实际上是复数乘法。此外,我已将其合并到 LuaLaTeX 程序中,就像我以前做的那样。

\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}

在此处输入图片描述

答案4

以下是两点之间的阿基米德螺线的简码(计算方程式)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} 

在此处输入图片描述

相关内容