/usr/share/doc/pyxplot/html/ex-trefoil.html is in pyxplot-doc 0.8.4-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta name="generator" content="plasTeX" />
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<title>PyXPlot Users' Guide: Two-dimensional parametric surfaces</title>
<link href="sec-legends.html" title="Graph Legends" rel="next" />
<link href="ex-spirograph.html" title="Plotting Parametric Functions" rel="prev" />
<link href="ex-spirograph.html" title="Plotting Parametric Functions" rel="up" />
<link rel="stylesheet" href="styles/styles.css" />
</head>
<body>
<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="ex-spirograph.html" title="Plotting Parametric Functions"><img alt="Previous: Plotting Parametric Functions" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>
<td><a href="ex-spirograph.html" title="Plotting Parametric Functions"><img alt="Up: Plotting Parametric Functions" border="0" src="icons/up.gif" width="32" height="32" /></a></td>
<td><a href="sec-legends.html" title="Graph Legends"><img alt="Next: Graph Legends" border="0" src="icons/next.gif" width="32" height="32" /></a></td>
<td class="navtitle" align="center">PyXPlot Users' Guide</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>
<td><a href="sect0255.html" title="Index"><img border="0" alt="" src="icons/index.gif" width="32" height="32" /></a></td>
<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>
<div class="breadcrumbs">
<span>
<span>
<a href="index.html">PyXPlot Users' Guide</a> <b>:</b>
</span>
</span><span>
<span>
<a href="sect0043.html">Plotting and Vector Graphics</a> <b>:</b>
</span>
</span><span>
<span>
<a href="ch-plotting.html">Plotting: A Detailed Survey</a> <b>:</b>
</span>
</span><span>
<span>
<a href="ex-spirograph.html">Plotting Parametric Functions</a> <b>:</b>
</span>
</span><span>
<span>
<b class="current">Two-dimensional parametric surfaces</b>
</span>
</span>
<hr />
</div>
<div><h2 id="ex:trefoil">1.6.1 Two-dimensional parametric surfaces</h2>
<p>PyXPlot can also plot datasets which can be parameterised in terms of two free parameters <img src="images/img-0428.png" alt="$u$" style="vertical-align:0px;
width:10px;
height:8px" class="math gen" /> and <img src="images/img-0054.png" alt="$v$" style="vertical-align:0px;
width:9px;
height:8px" class="math gen" />. This is most often useful in conjunction with the <tt class="tt">surface</tt> plot style, allowing any <img src="images/img-0429.png" alt="$(u,v)$" style="vertical-align:-4px;
width:40px;
height:18px" class="math gen" />-surface to be plotted. However, it also works in conjunction with any other plot style, allowing, for example, <img src="images/img-0429.png" alt="$(u,v)$" style="vertical-align:-4px;
width:40px;
height:18px" class="math gen" />-grids of points to be constructed. </p><p>As in the case of parametric lines above, the range of values that each free parameter should take must be specified. This can be done using the <a name="a0000000734" id="a0000000734"></a><tt class="tt">set urange</tt> and <a name="a0000000735" id="a0000000735"></a><tt class="tt">set vrange</tt> commands. These commands also act to switch PyXPlot between one- and two-dimensional parametric function evaluation; whilst the <tt class="tt">set trange</tt> command indicates that the next parametric function should be evaluated along a single raster of values of <img src="images/img-0056.png" alt="$t$" style="vertical-align:0px;
width:6px;
height:12px" class="math gen" />, the <tt class="tt">set urange</tt> and <tt class="tt">set vrange</tt> commands indicate that a grid of <img src="images/img-0429.png" alt="$(u,v)$" style="vertical-align:-4px;
width:40px;
height:18px" class="math gen" /> values should be used. By default, the range of values used for <img src="images/img-0428.png" alt="$u$" style="vertical-align:0px;
width:10px;
height:8px" class="math gen" /> and <img src="images/img-0054.png" alt="$v$" style="vertical-align:0px;
width:9px;
height:8px" class="math gen" /> is <img src="images/img-0182.png" alt="$0\to 1$" style="vertical-align:-1px;
width:45px;
height:13px" class="math gen" />. </p><p>The number of samples to be taken can be specified using a command of the form<a name="a0000000736" id="a0000000736"></a> </p><pre>
set sample grid 20x50
</pre><p> which specifies that 20 different values of <img src="images/img-0428.png" alt="$u$" style="vertical-align:0px;
width:10px;
height:8px" class="math gen" /> and 50 different values of <img src="images/img-0054.png" alt="$v$" style="vertical-align:0px;
width:9px;
height:8px" class="math gen" /> should be used, yielding a total of 1000 datapoints. The following example uses the <tt class="tt">lines</tt> plot style to generate a sequence of cross-sections through a two-dimensional Gaussian surface: </p><pre>
set sample grid 20x20
set urange [-1:1]
set vrange [-1:1]
f(u,v) = 0.4*exp(-(u**2+v**2)/0.2)
plot parametric u:v+f(u,v) with l
</pre><p> <center>
<img src="images/img-0431.png" alt="\includegraphics[width=5cm]{examples/eps/ex_datagrid}" style="width:5cm" /></center> </p><p>The ranges of values to use for <img src="images/img-0428.png" alt="$u$" style="vertical-align:0px;
width:10px;
height:8px" class="math gen" /> and <img src="images/img-0054.png" alt="$v$" style="vertical-align:0px;
width:9px;
height:8px" class="math gen" /> may alternatively be specified on a dataset-by-dataset basis within the plot command, as in the example </p><pre>
plot parametric [0:1][0:1] u:v , \
parametric [0:1] sin(t):cos(t)
</pre><p> <span class="upshape"><span class="mdseries"><span class="rm">Torus.</span></span></span></p><div>
<table cellspacing="0" class="tabular">
<tr>
<td style="border-top-style:solid; border-left:1px solid black; border-right:1px solid black; border-top-color:black; border-top-width:1px; text-align:left"><p> In this example we plot a torus, which can be parametrised in terms of two free parameters <img src="images/img-0428.png" alt="$u$" style="vertical-align:0px;
width:10px;
height:8px" class="math gen" /> and <img src="images/img-0054.png" alt="$v$" style="vertical-align:0px;
width:9px;
height:8px" class="math gen" /> as </p><table id="a0000000737" cellpadding="7" width="100%" cellspacing="0" class="eqnarray">
<tr id="a0000000738">
<td style="width:40%"> </td>
<td style="vertical-align:middle; text-align:right"><img src="images/img-0412.png" alt="$\displaystyle x $" style="vertical-align:0px; width:10px; height:8px" class="math gen" /></td>
<td style="vertical-align:middle; text-align:center"><img src="images/img-0058.png" alt="$\displaystyle = $" style="vertical-align:2px; width:12px; height:4px" class="math gen" /></td>
<td style="vertical-align:middle; text-align:left"><img src="images/img-0433.png" alt="$\displaystyle (R + r\cos (v))\cos (u) $" style="vertical-align:-4px; width:159px; height:18px" class="math gen" /></td>
<td style="width:40%"> </td>
<td style="width:20%" class="eqnnum"> </td>
</tr><tr id="a0000000739">
<td style="width:40%"> </td>
<td style="vertical-align:middle; text-align:right"><img src="images/img-0414.png" alt="$\displaystyle y $" style="vertical-align:-4px; width:9px; height:12px" class="math gen" /></td>
<td style="vertical-align:middle; text-align:center"><img src="images/img-0058.png" alt="$\displaystyle = $" style="vertical-align:2px; width:12px; height:4px" class="math gen" /></td>
<td style="vertical-align:middle; text-align:left"><img src="images/img-0434.png" alt="$\displaystyle (R + r\cos (v))\sin (u) $" style="vertical-align:-4px; width:157px; height:18px" class="math gen" /></td>
<td style="width:40%"> </td>
<td style="width:20%" class="eqnnum"> </td>
</tr><tr id="a0000000740">
<td style="width:40%"> </td>
<td style="vertical-align:middle; text-align:right"><img src="images/img-0435.png" alt="$\displaystyle z $" style="vertical-align:0px; width:9px; height:8px" class="math gen" /></td>
<td style="vertical-align:middle; text-align:center"><img src="images/img-0058.png" alt="$\displaystyle = $" style="vertical-align:2px; width:12px; height:4px" class="math gen" /></td>
<td style="vertical-align:middle; text-align:left"><img src="images/img-0436.png" alt="$\displaystyle r\sin (v) , $" style="vertical-align:-4px; width:61px; height:18px" class="math gen" /></td>
<td style="width:40%"> </td>
<td style="width:20%" class="eqnnum"> </td>
</tr>
</table><p> where <img src="images/img-0428.png" alt="$u$" style="vertical-align:0px;
width:10px;
height:8px" class="math gen" /> and <img src="images/img-0054.png" alt="$v$" style="vertical-align:0px;
width:9px;
height:8px" class="math gen" /> both run in the range <img src="images/img-0437.png" alt="$[0:2\pi ]$" style="vertical-align:-5px;
width:50px;
height:18px" class="math gen" />, <img src="images/img-0438.png" alt="$R$" style="vertical-align:0px;
width:14px;
height:12px" class="math gen" /> is the distance of the tube’s centre from the centre of the torus, and <img src="images/img-0416.png" alt="$r$" style="vertical-align:0px;
width:8px;
height:8px" class="math gen" /> is the radius of the tube. </p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">R = 3</tt><br /><tt class="tt">r = 0.5</tt><br /><tt class="tt">set size square</tt><br /><tt class="tt">f(u,v) = (R+r*cos(v))*cos(u)</tt><br /><tt class="tt">g(u,v) = (R+r*cos(v))*sin(u)</tt><br /><tt class="tt">h(u,v) = r*sin(v)</tt><br /></p><p><tt class="tt">set urange [0:2*pi]</tt><br /><tt class="tt">set vrange [0:2*pi]</tt><br /><tt class="tt">set zrange [-2.5:2.5]</tt><br /></p><p><tt class="tt">set nokey</tt><br /><tt class="tt">set sample grid 50x20</tt><br /><tt class="tt">plot 3d parametric f(u,v):g(u,v):h(u,v) with surf fillcol blue</tt><br /></p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><center>
<img src="images/img-0440.png" alt="\includegraphics[width=8cm]{examples/eps/ex_torus}" style="width:8cm" /></center> </p></td>
</tr><tr>
<td style="border-bottom-style:solid; border-bottom-width:1px; border-left:1px solid black; border-right:1px solid black; text-align:left; border-bottom-color:black"> </td>
</tr>
</table>
</div><p> <span class="upshape"><span class="mdseries"><span class="rm">Trefoil knot.</span></span></span></p><div>
<table cellspacing="0" class="tabular">
<tr>
<td style="border-top-style:solid; border-left:1px solid black; border-right:1px solid black; border-top-color:black; border-top-width:1px; text-align:left"><p> In this example we plot a trefoil knot, which is the simplest non-trivial knot in topology. Simply put, this means that it is not possible to untie the knot without cutting it. The knot follows the line </p><table id="a0000000741" cellpadding="7" width="100%" cellspacing="0" class="eqnarray">
<tr id="a0000000742">
<td style="width:40%"> </td>
<td style="vertical-align:middle; text-align:right"><img src="images/img-0412.png" alt="$\displaystyle x $" style="vertical-align:0px; width:10px; height:8px" class="math gen" /></td>
<td style="vertical-align:middle; text-align:center"><img src="images/img-0058.png" alt="$\displaystyle = $" style="vertical-align:2px; width:12px; height:4px" class="math gen" /></td>
<td style="vertical-align:middle; text-align:left"><img src="images/img-0442.png" alt="$\displaystyle (2 + \cos (3t))\cos (2t) $" style="vertical-align:-4px; width:155px; height:18px" class="math gen" /></td>
<td style="width:40%"> </td>
<td style="width:20%" class="eqnnum"> </td>
</tr><tr id="a0000000743">
<td style="width:40%"> </td>
<td style="vertical-align:middle; text-align:right"><img src="images/img-0414.png" alt="$\displaystyle y $" style="vertical-align:-4px; width:9px; height:12px" class="math gen" /></td>
<td style="vertical-align:middle; text-align:center"><img src="images/img-0058.png" alt="$\displaystyle = $" style="vertical-align:2px; width:12px; height:4px" class="math gen" /></td>
<td style="vertical-align:middle; text-align:left"><img src="images/img-0443.png" alt="$\displaystyle (2 + \cos (3t))\sin (2t) $" style="vertical-align:-4px; width:153px; height:18px" class="math gen" /></td>
<td style="width:40%"> </td>
<td style="width:20%" class="eqnnum"> </td>
</tr><tr id="a0000000744">
<td style="width:40%"> </td>
<td style="vertical-align:middle; text-align:right"><img src="images/img-0435.png" alt="$\displaystyle z $" style="vertical-align:0px; width:9px; height:8px" class="math gen" /></td>
<td style="vertical-align:middle; text-align:center"><img src="images/img-0058.png" alt="$\displaystyle = $" style="vertical-align:2px; width:12px; height:4px" class="math gen" /></td>
<td style="vertical-align:middle; text-align:left"><img src="images/img-0444.png" alt="$\displaystyle \sin (3t) , $" style="vertical-align:-4px; width:56px; height:18px" class="math gen" /></td>
<td style="width:40%"> </td>
<td style="width:20%" class="eqnnum"> </td>
</tr>
</table><p> but in this example we construct a tube around this line using the following parameterisation: </p><table id="a0000000745" cellpadding="7" width="100%" cellspacing="0" class="eqnarray">
<tr id="a0000000746">
<td style="width:40%"> </td>
<td style="vertical-align:middle; text-align:right"><img src="images/img-0412.png" alt="$\displaystyle x $" style="vertical-align:0px; width:10px; height:8px" class="math gen" /></td>
<td style="vertical-align:middle; text-align:center"><img src="images/img-0058.png" alt="$\displaystyle = $" style="vertical-align:2px; width:12px; height:4px" class="math gen" /></td>
<td style="vertical-align:middle; text-align:left"><img src="images/img-0445.png" alt="$\displaystyle \cos (2u)\cos (v) + r\cos (2u)(1.5+\sin (3u)/2) $" style="vertical-align:-5px; width:332px; height:19px" class="math gen" /></td>
<td style="width:40%"> </td>
<td style="width:20%" class="eqnnum"> </td>
</tr><tr id="a0000000747">
<td style="width:40%"> </td>
<td style="vertical-align:middle; text-align:right"><img src="images/img-0414.png" alt="$\displaystyle y $" style="vertical-align:-4px; width:9px; height:12px" class="math gen" /></td>
<td style="vertical-align:middle; text-align:center"><img src="images/img-0058.png" alt="$\displaystyle = $" style="vertical-align:2px; width:12px; height:4px" class="math gen" /></td>
<td style="vertical-align:middle; text-align:left"><img src="images/img-0446.png" alt="$\displaystyle \sin (2u)\cos (v) + r\sin (2u)(1.5+\sin (3u)/2) $" style="vertical-align:-5px; width:328px; height:19px" class="math gen" /></td>
<td style="width:40%"> </td>
<td style="width:20%" class="eqnnum"> </td>
</tr><tr id="a0000000748">
<td style="width:40%"> </td>
<td style="vertical-align:middle; text-align:right"><img src="images/img-0435.png" alt="$\displaystyle z $" style="vertical-align:0px; width:9px; height:8px" class="math gen" /></td>
<td style="vertical-align:middle; text-align:center"><img src="images/img-0058.png" alt="$\displaystyle = $" style="vertical-align:2px; width:12px; height:4px" class="math gen" /></td>
<td style="vertical-align:middle; text-align:left"><img src="images/img-0447.png" alt="$\displaystyle \sin (v)+R\cos (3u) , $" style="vertical-align:-4px; width:146px; height:18px" class="math gen" /></td>
<td style="width:40%"> </td>
<td style="width:20%" class="eqnnum"> </td>
</tr>
</table><p> where <img src="images/img-0428.png" alt="$u$" style="vertical-align:0px;
width:10px;
height:8px" class="math gen" /> and <img src="images/img-0054.png" alt="$v$" style="vertical-align:0px;
width:9px;
height:8px" class="math gen" /> run in the ranges <img src="images/img-0437.png" alt="$[0:2\pi ]$" style="vertical-align:-5px;
width:50px;
height:18px" class="math gen" /> and <img src="images/img-0448.png" alt="$[-\pi :\pi ]$" style="vertical-align:-5px;
width:57px;
height:18px" class="math gen" /> respectively, and <img src="images/img-0416.png" alt="$r$" style="vertical-align:0px;
width:8px;
height:8px" class="math gen" /> and <img src="images/img-0438.png" alt="$R$" style="vertical-align:0px;
width:14px;
height:12px" class="math gen" /> determine the size and thickness of the knot as in an analogous fashion to the previous example. </p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">R = 2</tt><br /><tt class="tt">r = 5</tt><br /><tt class="tt">set size square</tt><br /><tt class="tt">f(u,v) = cos(2*u)*cos(v) + r*cos(2*u)*(1.5+sin(3*u)/2)</tt><br /><tt class="tt">g(u,v) = sin(2*u)*cos(v) + r*sin(2*u)*(1.5+sin(3*u)/2)</tt><br /><tt class="tt">h(u,v) = sin(v)+R*cos(3*u)</tt><br /></p><p><tt class="tt">set urange [0:2*pi]</tt><br /><tt class="tt">set vrange [-pi:pi]</tt><br /></p><p><tt class="tt">set nokey</tt><br /><tt class="tt">set sample grid 150x20</tt><br /><tt class="tt">plot 3d parametric f(u,v):g(u,v):h(u,v) with surf fillcol blue</tt><br /></p></td>
</tr><tr>
<td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><center>
<img src="images/img-0450.png" alt="\includegraphics[width=8cm]{examples/eps/ex_trefoil}" style="width:8cm" /></center> </p></td>
</tr><tr>
<td style="border-bottom-style:solid; border-bottom-width:1px; border-left:1px solid black; border-right:1px solid black; text-align:left; border-bottom-color:black"> </td>
</tr>
</table>
</div></div>
<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="ex-spirograph.html" title="Plotting Parametric Functions"><img alt="Previous: Plotting Parametric Functions" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>
<td><a href="ex-spirograph.html" title="Plotting Parametric Functions"><img alt="Up: Plotting Parametric Functions" border="0" src="icons/up.gif" width="32" height="32" /></a></td>
<td><a href="sec-legends.html" title="Graph Legends"><img alt="Next: Graph Legends" border="0" src="icons/next.gif" width="32" height="32" /></a></td>
<td class="navtitle" align="center">PyXPlot Users' Guide</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>
<td><a href="sect0255.html" title="Index"><img border="0" alt="" src="icons/index.gif" width="32" height="32" /></a></td>
<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>
<script language="javascript" src="icons/imgadjust.js" type="text/javascript"></script>
</body>
</html>
|