File: buttrfly.tex

package info (click to toggle)
texlive-base 2012.20120611-5
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 403,288 kB
  • sloc: perl: 37,753; ruby: 4,714; sh: 4,212; makefile: 3,659; xml: 2,387; ansic: 1,731; python: 1,029; tcl: 631; awk: 603; cpp: 549; lisp: 428; java: 32; sed: 8
file content (31 lines) | stat: -rw-r--r-- 904 bytes parent folder | download | duplicates (9)
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}