summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/lapdf/buttrfly.tex
blob: df8ea18e6d69cd49f40903ee23894ada365fb6f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
% ---------------------------------------------------------------------------
% The butterfly curve is defined by the equation:
%     r=exp(cos(a))-2*cos(4*a)+sin^5(a/n).  (we use n = 14)
% ---------------------------------------------------------------------------
\input preamble.tex

\Defnum(\n,0)
\newcount\m
\newdimen\x
\newdimen\y
\newdimen\z

% ---------------------------------------------------------------------------
\begin{document}
\begin{center}
{\Huge \bf{The Butterfly Curve}}
\bigskip

\begin{lapdf}(16,16)(-7,-8)
 \col=6
 \def\Px(#1,#2){\Dset(\x,#1) \y=4\x \z=0.0714\x
  \Cos(\Np\x,\x) \Exp(\Np\x,#2) \Cos(\Np\y,\y) \Mul(\y,2)
  \Sin(\Np\z,\z) \Pot(\Np\z,5,\z) \Sub(#2,\y) \Add(#2,\z) #2=2.2#2}

 \Whilenum{\n<24}{%
  \m=\n \Add(\m,1) \Stepcol(0,23, 2) \Pplot(100)(\n,\m) \Stroke \Add(\n,1)}
\end{lapdf}

$r(\phi)=exp(\cos(\phi))-2cos(4\phi)+sin^5(\phi/14)$
\end{center}
\end{document}