ch5.mp 16.6 KB
Newer Older
1 2 3 4 5 6 7 8
% CH5.mp
%  MetaPost input file with chapter five pictures.
%
% HISTORY
% 2001-Apr-15 Jim Hefferon jim@joshua.smcvt.edu Written
verbatimtex
%&latex
\documentclass{book}
9
\usepackage{bookjh}
Jim Hefferon's avatar
Jim Hefferon committed
10
\usepackage{linalgjh}
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
\begin{document}
etex

input jh
input arrow

defaultscale := 9pt/fontsize defaultfont;

numeric u;  %scaling factor
numeric v;  %vertical scaling factor
numeric w;  %horizontal scaling factor

u:=.04in; v:=u; w:=v;


%--------------------------------
%  section 5.3
%   Map from a space to itself, iterated.
%
beginfig(1);   % map from a space to itself
  %numeric u;  %scaling factor
  %numeric v;  %vertical scaling factor
  %numeric w;  %horizontal scaling factor
  numeric a, b; a=.8in; b=1.1a; % a is width of set, b is hgt
  set_pic(a,b);
  z1=(.4a,.9b);
    drawpoint(z1); label.lft(btex $\vec{v}$ etex,z1);
  z2=(.5a,.55b);
    drawpoint(z2); label.lft(btex $t(\vec{v}\,)$ etex,z2);
  z3=(.6a,.15b);
    drawpoint(z3); label.lft(btex $t^2(\vec{v}\,)$ etex,z3);
  %mapsto(z1,.5[z1,z2]+(.1a,0),z2);
  %mapsto(z2,.5[z2,z3]+(.1a,0),z3);
  draw_action_arrow(z1..(.5[z1,z2]+(.1a,0))..z2);
  draw_action_arrow(z2..(.5[z2,z3]+(.1a,0))..z3);
endfig;


%--------------------------------
%  section 5.3
%   Graph of rank and nullity, on iteration of a transformation.
%
beginfig(2);
  %numeric u;  %scaling factor
  %numeric v;  %vertical scaling factor
  %numeric w;  %horizontal scaling factor
  numeric a, b; % a is width, b is height
  a=2.5in; b=1.25in;
  draw begingraph(a,b);
    setrange(origin,whatever,whatever);
    gdraw "ranknullity.d" plot drawn_point; % btex$\circ$etex;
%   glabel.lft(btex \begin{tabular}{r}
%                         nullity of $t^j$ (above) \\ 
%                         and                      \\ 
%                         rank of $t^j$ (below)
% 			\end{tabular} etex,OUT);
Jim Hefferon's avatar
Jim Hefferon committed
67
    glabel.bot(btex \small Power $j$ of the transformation etex,OUT);
68 69 70 71
    otick.bot(btex \small $0$etex,1);    
    otick.bot(btex \small $1$etex,2);    
    otick.bot(btex \small $2$etex,3);    
    otick.bot(btex \small $j$etex,5);    
72 73 74
    otick.bot(btex{\ }etex,8);    
    grid.bot(btex$n$etex,9) withcolor .85white;    
    otick.bot(btex{\ }etex,10);    
Jim Hefferon's avatar
Jim Hefferon committed
75
    grid.lft(btex \small $n$etex,8) withcolor .85white;    
76 77
    otick.lft(btex{\ }etex,7);    
    otick.lft(btex{\ }etex,6);    
Jim Hefferon's avatar
Jim Hefferon committed
78
    otick.lft(btex$\small \text{rank}(t^j)$etex,3);    
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
    otick.lft(btex{\ }etex,1);    
    otick.lft(btex{\ }etex,1);    
    otick.lft(btex{\ }etex,1);    
    frame.llft;
  endgraph;
endfig;

%--------------------------------
%  section 5.3
%   Graph of rank and nullity, on iteration of a transformation.
%
beginfig(3);  %graph of rank and nullity on iteration
  %numeric u;  %scaling factor
  %numeric v;  %vertical scaling factor
  %numeric w;  %horizontal scaling factor
  numeric a, b; % a is width, b is height
  a=2.5in; b=1.25in;
  pickup pensquare scaled line_width_light;
  draw (0,b)--(0,0)--(a,0);
  label.lft(btex \begin{tabular}{r}
                      nullity of $t^j$ (above) \\ 
                      and                      \\
		      rank of $t^j$ (below)
		    \end{tabular} etex,.5[(0,b),(0,0)]);
  label.bot(btex Power $j$ of the transformation etex,.5[(0,0),(a,0)]);
endfig;





beginfig(4) % equiv relation; row-equiv mats from ch1.27, further split 
  numeric u;  %scaling factor
  numeric v;  %vertical scaling factor
  numeric w;  %horizontal scaling factor
  u:=1in; v:=u; w:=v; % was: 1in

  path p[]; partition; % dotlabels.ulft(5,6,7,8,9,10,11,12,13);
117
  label(btex {\small \ldots} etex,z13);
118
  x14=.8[x0,x9]; y14=.7[y10,y9]; drawpoint(z14);
119
    label.rt(btex {\small $S$} etex,z14);
120
  x15=.85[x0,x9]; y15=.3[y10,y9]; drawpoint(z15);
121
    label.rt(btex {\small $T$} etex,z15);
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

  pickup pencircle scaled line_width_light;
  % split part in center
  z20=.5[z6,z8]; x21=.8[x20,x14]; y21=y20;
    z22=(z20--(3[z20,z21])) intersectionpoint p3;
    p20 = z20--z22;
    draw p20 dashed evenly scaled .5;
  z23 = point .6 of p1;
    z24 = whatever[z20,z22]; x24 = x23;
    p21 = z23--z24;
    draw p21 dashed evenly scaled .5;
  % split part in upper left
  z30 = point .25 of p1;
    z31 = whatever[z0,z3]; y31 = y30;
    p30 = z30--z31; 
    draw p30 dashed evenly scaled .5;
  % split part in upper right
  z40 = point .55 of p4;
  z41 = point .85 of p4;
    z42 = whatever[z2,z3]; x42 = x40;
    p40 = z40--z42;
    z43 = whatever[z2,z3]; x43 = x41;
    p41 = z41--z43;
    draw p40 dashed evenly scaled .5;
    draw p41 dashed evenly scaled .5;
endfig;







beginfig(5) % equiv relation; finer partition needs more reps 
  numeric u;  %scaling factor
  numeric v;  %vertical scaling factor
  numeric w;  %horizontal scaling factor
  u:=1in; v:=u; w:=v; % was: 1in

  path p[]; partition; % dotlabels.ulft(5,6,7,8,9,10,11,12,13);
162
  label(btex {\small \ldots} etex,z13);
163
  x14=.8[x0,x9]; y14=.7[y10,y9]; %drawpoint(z14);
164
    label.rt(btex {\small $\star$} etex,z14);
165
  x15=.75[x0,x9]; y15=.35[y10,y9]; %drawpoint(z15);
166
    label.rt(btex {\small $\star$} etex,z15);
167 168 169 170 171 172 173 174 175 176 177 178

  pickup pencircle scaled line_width_light;
  % split part in center
  z20=.5[z6,z8]; x21=.8[x20,x14]; y21=y20;
    z22=(z20--(3[z20,z21])) intersectionpoint p3;
    p20 = z20--z22;
    draw p20 dashed evenly scaled .5;
  z23 = point .6 of p1;
    z24 = whatever[z20,z22]; x24 = x23;
    p21 = z23--z24;
    draw p21 dashed evenly scaled .5;
    z25=.55[z20,z24]; z26=.4[z24,z23];
179
    label(btex {\small $\star$} etex,(x25,y26));
180 181 182 183 184 185
  % split part in upper left
  z30 = point .25 of p1;
    z31 = whatever[z0,z3]; y31 = y30;
    p30 = z30--z31; 
    draw p30 dashed evenly scaled .5;
    z32=.35[z31,z30]; z33=.5[z6,z31];
186
    label(btex {\small $\star$} etex,(x32,y33));
187
    z34=.55[z31,z30]; z35=.5[z3,z31];
188
    label(btex {\small $\star$} etex,(x34,y35));
189 190 191 192 193 194 195 196 197 198 199
  % split part in upper right
  z40 = point .55 of p4;
  z41 = point .85 of p4;
    z42 = whatever[z2,z3]; x42 = x40;
    p40 = z40--z42;
    z43 = whatever[z2,z3]; x43 = x41;
    p41 = z41--z43;
    draw p40 dashed evenly scaled .5;
    draw p41 dashed evenly scaled .5;

    z44=.5[z5,z43]; z45=.45[z41,z43];
200
    label(btex {\small $\star$} etex,(x44,y45));
201
    z46=.5[z43,z42]; z47=.55[z41,z43];
202
    label(btex {\small $\star$} etex,(x46,y47));
203
    z48=.45[z42,z11]; z49=.65[z40,z42];
204
    label(btex {\small $\star$} etex,(x48,y49));
205 206
  % then lower left
  z50=.4[z0,z7]; z51=.4[z0,z8];
207
  label(btex {\small $\star$} etex,(x50,y51));
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

  %dotlabels.top(20,21,22,23,24,30,31,40,41,42,43);
endfig;








% ==================== Linear Recurrences ===============


beginfig(6) % Tower of Hanoi (three disks at start) 
  numeric u;  %scaling factor
  numeric v;  %vertical scaling factor
  numeric w;  %horizontal scaling factor
  u:=10pt; v:=u; w:=v; %

  save disk_length, disk_width, disk_hgt;
  numeric disk_length, disk_width, disk_hgt;
  disk_length = 8u;  disk_width = .4disk_length; disk_hgt = .2u;
  save needle_shift; pair needle_shift; needle_shift = (1.2disk_length,0v);
  save needle_length, needle_width, needle_hgt;
  numeric needle_length, needle_width, needle_hgt; % how thick is body of bee?
Jim Hefferon's avatar
Jim Hefferon committed
234
  needle_length = .4u; needle_width = .4needle_length; needle_hgt = 4u;
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
  % left needle
  drawdisk(disk_length,disk_width,disk_hgt);
  drawdisk(.9disk_length,.9disk_width,disk_hgt) shifted (0,1.5disk_hgt);
  drawdisk(.8disk_length,.8disk_width,disk_hgt) shifted (0,3disk_hgt);
  drawdisk(needle_length,needle_width,needle_hgt-3disk_hgt)
     shifted (0,needle_hgt);
  % middle needle
  drawdisk(needle_length,needle_width,needle_hgt)
     shifted (0,needle_hgt) shifted needle_shift;
  % right needle
  drawdisk(needle_length,needle_width,needle_hgt)
     shifted (0,needle_hgt) shifted 2needle_shift;
endfig;





beginfig(7) % Tower of Hanoi (three disks at start) 
  numeric u;  %scaling factor
  numeric v;  %vertical scaling factor
  numeric w;  %horizontal scaling factor
  u:=10pt; v:=u; w:=v; %

  save disk_length, disk_width, disk_hgt;
  numeric disk_length, disk_width, disk_hgt;
  disk_length = 8u;  disk_width = .4disk_length; disk_hgt = .2u;
  save needle_shift; pair needle_shift; needle_shift = (1.2disk_length,0v);
  save needle_length, needle_width, needle_hgt;
  numeric needle_length, needle_width, needle_hgt; % how thick is body of bee?
Jim Hefferon's avatar
Jim Hefferon committed
265
  needle_length = .4u; needle_width = .4needle_length; needle_hgt = 4u;
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
  % left needle
  drawdisk(disk_length,disk_width,disk_hgt);
  drawdisk(needle_length,needle_width,needle_hgt-disk_hgt)
     shifted (0,needle_hgt);
  % middle needle
  drawdisk(.9disk_length,.9disk_width,disk_hgt)
    shifted needle_shift;
  drawdisk(.8disk_length,.8disk_width,disk_hgt)
    shifted (0,1.5disk_hgt) shifted needle_shift;
  drawdisk(needle_length,needle_width,needle_hgt-2disk_hgt)
     shifted (0,needle_hgt) shifted needle_shift;
  % right needle
  drawdisk(needle_length,needle_width,needle_hgt)
     shifted (0,needle_hgt) shifted 2needle_shift;
endfig;


Jim Hefferon's avatar
Jim Hefferon committed
283 284 285 286 287 288 289 290 291 292


beginfig(8) % graph of rank falling and nullity rising
  numeric u;  %scaling factor
  numeric v;  %vertical scaling factor
  numeric w;  %horizontal scaling factor
  u:=10pt; v:=u; w:=v; %
  
  % axes
  z0=(0w,0v);
Jim Hefferon's avatar
Jim Hefferon committed
293 294
  z1=(+.5w,0v); z2=(21.5w,0v);  % x axis
  z3=(0w,+.5v); z4=(0w,9.5v);  % y axis
Jim Hefferon's avatar
Jim Hefferon committed
295 296 297
  pickup pensquare scaled line_width_light;
  draw z1--z2;
  draw z3--z4;
Jim Hefferon's avatar
Jim Hefferon committed
298 299
  % label.lrt(btex \small power etex,z2);
  % label.ulft(btex \small rank etex,z4);
Jim Hefferon's avatar
Jim Hefferon committed
300
  % point of interest
Jim Hefferon's avatar
Jim Hefferon committed
301
  z10=(10w,3.75v);
Jim Hefferon's avatar
Jim Hefferon committed
302 303 304 305 306
  % ticks
  pickup updown_tick;
  for i = 1 upto 3:
    drawdot (i*w,0v);
  endfor
307 308 309
  label.bot(btex \small $0$ etex,(1w,0v));
  label.bot(btex \small $1$ etex,(2w,0v));
  label.bot(btex \small $2$ etex,(3w,0v));
Jim Hefferon's avatar
Jim Hefferon committed
310
  drawdot (x10,0v);
311
  label.bot(btex \small $j$ etex,(10w,0v));
Jim Hefferon's avatar
Jim Hefferon committed
312
  for i = 17 upto 21:
Jim Hefferon's avatar
Jim Hefferon committed
313 314
    drawdot (i*w,0v);
  endfor
315 316 317
  % label.bot(btex \small $k$ etex,(18w,0v));
  label.bot(btex \small $n$ etex,(20w,0v));
  % label.bot(btex \small $k+1$ etex,(14w,0v));
Jim Hefferon's avatar
Jim Hefferon committed
318
  pickup sidetoside_tick;
Jim Hefferon's avatar
Jim Hefferon committed
319
  for i = 9 upto 9:
Jim Hefferon's avatar
Jim Hefferon committed
320 321
    drawdot (0w,i*v);
  endfor
322
  label.lft(btex \small $n$ etex,(0w,9v));
Jim Hefferon's avatar
Jim Hefferon committed
323 324
  % drawdot (0w,y10);
  for i = 1 upto 1:
Jim Hefferon's avatar
Jim Hefferon committed
325 326
    drawdot (0w,i*v);
  endfor
327
  label.lft(btex \small $0$ etex,(0w,1v));
Jim Hefferon's avatar
Jim Hefferon committed
328
  % The points
Jim Hefferon's avatar
Jim Hefferon committed
329
  numeric whisker_width; whisker_width=.4v;
Jim Hefferon's avatar
Jim Hefferon committed
330 331 332
  pickup pencircle scaled line_width_light;
  drawpoint(z10);
    pickup pensquare  scaled line_width_light;
333 334 335
    draw (x10,y10+0.5v)--(x10,y4-0.5v) withcolor shading_color;  % vert line above dot
    draw (x10-.5whisker_width,y4-0.5v)--(x10+.5whisker_width,y4-0.5v) withcolor shading_color; % whisker at  top
    draw (x10-.5whisker_width,y10+0.5v)--(x10+.5whisker_width,y10+0.5v) withcolor shading_color; % whisker at  bot
336
    label.rt(btex \small $\nullity (t^j)$ etex,(x10,.5[y10,y4]));
337 338 339
    draw (x10,y10-0.5v)--(x10,1v) withcolor shading_color; % vert line below dot
    draw (x10-.5whisker_width,y10-0.5v)--(x10+.5whisker_width,y10-0.5v) withcolor shading_color; % whisker at top
    draw (x10-.5whisker_width,1v)--(x10+.5whisker_width,1v) withcolor shading_color; % whisker at bot
340
    label.lft(btex \small $\rank (t^j)$ etex,(x10,.55[y10,1v]));
Jim Hefferon's avatar
Jim Hefferon committed
341 342 343 344
  pickup pencircle scaled line_width_light;
  drawpoint((1w,9v));
  drawpoint((2w,7v));
  drawpoint((3w,6v));
Jim Hefferon's avatar
Jim Hefferon committed
345
  drawpoint((17w,2.2v));
Jim Hefferon's avatar
Jim Hefferon committed
346 347 348
  drawpoint((18w,2v));
  drawpoint((19w,2v));
  drawpoint((20w,2v));
Jim Hefferon's avatar
Jim Hefferon committed
349
  % drawpoint((21w,2v));
350
  label(btex \small $\ldots$ etex,(21w,2v));
Jim Hefferon's avatar
Jim Hefferon committed
351 352 353
  % Generalized spaces
    z20=(20w,2v); % were to anchor the line for generalized spaces
    pickup pensquare  scaled line_width_light;
354 355 356
    draw (x20,y20+0.5v)--(x20,y4-0.5v) withcolor shading_color;  % vert line above dot
    draw (x20-.5whisker_width,y4-0.5v)--(x20+.5whisker_width,y4-0.5v) withcolor shading_color; % whisker at  top
    draw (x20-.5whisker_width,y20+0.5v)--(x20+.5whisker_width,y20+0.5v) withcolor shading_color; % whisker at  bot
357
    label.rt(btex \small $\dim(\gennullspace{t})$ etex,(x20,.5[y20,y4]));
Jim Hefferon's avatar
Jim Hefferon committed
358
    draw (x20,y20-0.5v)--(x20,1v) withcolor medgray; % vert line below dot
359 360
    draw (x20-.5whisker_width,y20-0.5v)--(x20+.5whisker_width,y20-0.5v) withcolor shading_color; % whisker at top
    draw (x20-.5whisker_width,1v)--(x20+.5whisker_width,1v) withcolor shading_color; % whisker at bot
361
    label.rt(btex \small $\dim(\genrangespace{t})$ etex,(x20,.8[y20,1v]));
Jim Hefferon's avatar
Jim Hefferon committed
362 363 364
endfig;


Jim Hefferon's avatar
Jim Hefferon committed
365 366 367 368 369 370 371 372 373

%--------------------------------
%  Topic: Page Rank
%    Graph illustrating page links
%
beginfig(9);   % m
  %numeric u;  %scaling factor
  %numeric v;  %vertical scaling factor
  %numeric w;  %horizontal scaling factor
374
  numeric circlescale; circlescale=19pt;
Jim Hefferon's avatar
Jim Hefferon committed
375 376 377 378 379
  path node; node=fullcircle scaled circlescale;
  path n[]; % node paths
  pickup pencircle scaled line_width_light;
  z1=(0w,6v);
    n1=node shifted z1;
380
    draw n1; label(btex \small $p_1$ etex,z1);
Jim Hefferon's avatar
Jim Hefferon committed
381 382
  z2=(9w,y1);
    n2=node shifted z2;
383
    draw n2; label(btex \small $p_2$ etex,z2);
Jim Hefferon's avatar
Jim Hefferon committed
384 385
  z3=(x2,0v);
    n3=node shifted z3;
386
    draw n3; label(btex \small $p_3$ etex,z3);
Jim Hefferon's avatar
Jim Hefferon committed
387 388
  z4=(x1,y3);
    n4=node shifted z4;
389
    draw n4; label(btex \small $p_4$ etex,z4);
Jim Hefferon's avatar
Jim Hefferon committed
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414
  path p[], q[];
  pair times[];  % intersection times
  % arrow from p1 to p2 
  p12=z1--z2;  
  times121=p12 intersectiontimes n1;
  times122=p12 intersectiontimes n2;
  drawarrow subpath(xpart(times121)+.05,xpart(times122)-.05) of p12;
  % arrow from p2 to p3 
  p23=z2--z3;  
  times232=p23 intersectiontimes n2;
  times233=p23 intersectiontimes n3;
  drawdblarrow subpath(xpart(times232)+.05,xpart(times233)-.05) of p23;
  % arrow from p3 to p1 
  p31=z3--z1;  
  times313=p31 intersectiontimes n3;
  times311=p31 intersectiontimes n1;
  drawarrow subpath(xpart(times313)+.05,xpart(times311)-.05) of p31;
  % arrow from p3 to p4 
  p34=z3--z4;  
  times343=p34 intersectiontimes n3;
  times344=p34 intersectiontimes n4;
  drawarrow subpath(xpart(times343)+.05,xpart(times344)-.05) of p34;
endfig;


415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470
%    Exercise from KURT BRYAN AND TANYA LEISE
%
beginfig(10);   % m
  %numeric u;  %scaling factor
  %numeric v;  %vertical scaling factor
  %numeric w;  %horizontal scaling factor
  numeric circlescale; circlescale=19pt;
  path node; node=fullcircle scaled circlescale;
  path n[]; % node paths
  pickup pencircle scaled line_width_light;
  z1=(0w,6v);
    n1=node shifted z1;
    draw n1; label(btex \small $p_1$ etex,z1);
  z2=(9w,y1);
    n2=node shifted z2;
    draw n2; label(btex \small $p_2$ etex,z2);
  z3=(x2,0v);
    n3=node shifted z3;
    draw n3; label(btex \small $p_3$ etex,z3);
  z4=(x1,y3);
    n4=node shifted z4;
    draw n4; label(btex \small $p_4$ etex,z4);
  path p[], q[];
  pair times[];  % intersection times
  % arrow from p1 to p2 
  p12=z1--z2;  
  times121=p12 intersectiontimes n1;
  times122=p12 intersectiontimes n2;
  drawarrow subpath(xpart(times121)+.05,xpart(times122)-.05) of p12;
  % arrow from p1 to p3 
  p13=z1--z3;  
  times131=p13 intersectiontimes n1;
  times133=p13 intersectiontimes n3;
  drawdblarrow subpath(xpart(times131)+.05,xpart(times133)-.05) of p13;
  % arrow from p1 to p4 
  p14=z1--z4;  
  times141=p14 intersectiontimes n1;
  times144=p14 intersectiontimes n4;
  drawdblarrow subpath(xpart(times141)+.05,xpart(times144)-.05) of p14;
  % arrow from p2 to p3 
  p23=z2--z3;  
  times232=p23 intersectiontimes n2;
  times233=p23 intersectiontimes n3;
  drawarrow subpath(xpart(times232)+.05,xpart(times233)-.05) of p23;
  % arrow from p2 to p4 
  p24=z2--z4;  
  times242=p24 intersectiontimes n2;
  times244=p24 intersectiontimes n4;
  drawarrow subpath(xpart(times242)+.05,xpart(times244)-.05) of p24;
  % arrow from p4 to p5 
  p43=z4--z3;  
  times433=p43 intersectiontimes n4;
  times434=p43 intersectiontimes n3;
  drawarrow subpath(xpart(times433)+.05,xpart(times434)-.05) of p43;
endfig;

471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516
%  Search: every site points in a circle
%
beginfig(11);   % 
  %numeric u;  %scaling factor
  %numeric v;  %vertical scaling factor
  %numeric w;  %horizontal scaling factor
  numeric circlescale; circlescale=19pt;
  path node; node=fullcircle scaled circlescale;
  path n[]; % node paths
  pickup pencircle scaled line_width_light;
  z1=(0w,6v);
    n1=node shifted z1;
    draw n1; label(btex \small $p_1$ etex,z1);
  z2=(9w,y1);
    n2=node shifted z2;
    draw n2; label(btex \small $p_2$ etex,z2);
  z3=(x2,0v);
    n3=node shifted z3;
    draw n3; label(btex \small $p_3$ etex,z3);
  z4=(x1,y3);
    n4=node shifted z4;
    draw n4; label(btex \small $p_4$ etex,z4);
  path p[], q[];
  pair times[];  % intersection times
  % arrow from p1 to p2 
  p12=z1--z2;  
  times121=p12 intersectiontimes n1;
  times122=p12 intersectiontimes n2;
  drawarrow subpath(xpart(times121)+.05,xpart(times122)-.05) of p12;
  % arrow from p2 to p3 
  p23=z2--z3;  
  times232=p23 intersectiontimes n2;
  times233=p23 intersectiontimes n3;
  drawarrow subpath(xpart(times232)+.05,xpart(times233)-.05) of p23;
  % arrow from p3 to p4 
  p34=z3--z4;  
  times343=p34 intersectiontimes n3;
  times344=p34 intersectiontimes n4;
  drawarrow subpath(xpart(times343)+.05,xpart(times344)-.05) of p34;
  % arrow from p4 to p1 
  p41=z4--z1;  
  times414=p41 intersectiontimes n4;
  times411=p41 intersectiontimes n1;
  drawarrow subpath(xpart(times414)+.05,xpart(times411)-.05) of p41;
endfig;

517

Jim Hefferon's avatar
Jim Hefferon committed
518 519


520
end