[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] manuscripts/Paper Makefile paper.tex zipfarea.mp
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] manuscripts/Paper Makefile paper.tex zipfarea.mp |
Date: |
Mon, 24 Mar 2003 11:24:27 -0500 |
CVSROOT: /cvsroot/gzz
Module name: manuscripts
Changes by: Tuomas J. Lukka <address@hidden> 03/03/24 11:24:27
Modified files:
Paper : Makefile paper.tex zipfarea.mp
Log message:
Illustrate zipf's law
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/manuscripts/Paper/Makefile.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/manuscripts/Paper/paper.tex.diff?tr1=1.52&tr2=1.53&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/manuscripts/Paper/zipfarea.mp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
Patches:
Index: manuscripts/Paper/Makefile
diff -u manuscripts/Paper/Makefile:1.6 manuscripts/Paper/Makefile:1.7
--- manuscripts/Paper/Makefile:1.6 Fri Mar 21 06:37:51 2003
+++ manuscripts/Paper/Makefile Mon Mar 24 11:24:27 2003
@@ -6,7 +6,7 @@
LATEXCMD=
endif
-all: pipe.1 perceptual-model.eps pipeline.eps buoyoing.1 buoyoing.5 zipf.ps
+all: pipe.1 perceptual-model.eps pipeline.eps buoyoing.1 buoyoing.5 zipf.ps
zipfarea.1
latex "${LATEXCMD} paper"
BIBINPUTS=..:$$BIBINPUTS bibtex paper
latex "${LATEXCMD} paper"
@@ -17,6 +17,9 @@
buoyoing.1 buoyoing.5: buoyoing.mp
TEX=latex mpost buoyoing
+
+zipfarea.1: zipfarea.mp
+ mpost zipfarea.mp
# doesn't work because of .ps screenshots
pdf: perceptual-model.pdf pipeline.pdf
Index: manuscripts/Paper/paper.tex
diff -u manuscripts/Paper/paper.tex:1.52 manuscripts/Paper/paper.tex:1.53
--- manuscripts/Paper/paper.tex:1.52 Sun Mar 23 15:16:05 2003
+++ manuscripts/Paper/paper.tex Mon Mar 24 11:24:27 2003
@@ -1248,15 +1248,16 @@
\centering
%\fbox{\vbox{\vskip 3in}}
\ifpics
-\includegraphics[width=6cm]{zipf}
+\includegraphics[width=6cm]{zipfarea.1}
\fi
\caption{
\label{fig-zipf}
-Idealized representation of typical document usage pattern according
-to Zipf's law:
-the solid curve represents the access count as a function of rank
-for 100 documents (only the first 15 shown)
-and the dotted curve represents the cumulative proportion of accesses.
+Zipf's law concretized: why remembering 15 textures helps.
+In real life, accesses to documents often follow Zipf's law, meaning that
+some documents get accessed far more often than most.
+Each square represents a document, and the area of each square is scaled
+to its rate of accesses.
+The diagram shows 2000 documents weighted with Zipf's law with exponent 1.1.
The 15 most important documents account XXX\% of the accesses.
}
\end{figure}
Index: manuscripts/Paper/zipfarea.mp
diff -u manuscripts/Paper/zipfarea.mp:1.2 manuscripts/Paper/zipfarea.mp:1.3
--- manuscripts/Paper/zipfarea.mp:1.2 Mon Mar 24 05:20:35 2003
+++ manuscripts/Paper/zipfarea.mp Mon Mar 24 11:24:27 2003
@@ -1,3 +1,6 @@
+
+prologues := 2;
+
beginfig(1);
@@ -5,9 +8,14 @@
path ucircle;
ucircle := fullcircle shifted (.5,.5);
+show bbox(ucircle);
h = 250;
+numeric coords[]x;
+numeric coords[]y;
+numeric coords[]h;
+
vardef getcoord(expr s, e) =
save tp;
save cp;
@@ -20,24 +28,77 @@
xpart(urcorner(tp))
enddef;
+ncircles = 0;
+
+nsteps = 5;
+
+vardef drawcircle(expr rad, cmi, cmc) =
+ fill unitsquare scaled rad shifted (cmi,cmc) withcolor (uniformdeviate(1),
uniformdeviate(1), uniformdeviate(1));
+ draw unitsquare scaled rad shifted (cmi,cmc) withpen pencircle scaled 1pt;
+enddef;
+
vardef addcircle(expr rad) =
save cmi, cmc;
save cur;
- cmi := 1000;
- for i = 0 upto h / rad:
- cur := getcoord(i*rad, (i+1)*rad);
-% show i,cur;
- if cur < cmi:
- cmi := cur;
- cmc := i * rad;
- fi
+ save rmost;
+ save npie;
+ numeric cmi;
+ numeric rmost[];
+ numeric npie;
+ npie := h / (rad/nsteps) - nsteps + 1;
+ for j = 0 upto npie:
+ rmost[j] := 0;
endfor;
- draw ucircle scaled rad shifted (cmi,cmc);
+ for i = 1 upto ncircles:
+ for j = floor(coords[i].y / (rad/nsteps) - nsteps + 1) upto
floor((coords[i].y+coords[i].h) / (rad/nsteps)):
+% show "LOOP:",i, coords[i].x,rmost[j];
+ if (j >= 0) and (j <= npie):
+ if (rmost[j] < coords[i].x):
+ % show "SET";
+ rmost[j] := coords[i].x;
+ fi;
+ fi
+ endfor
+ endfor;
+ cmi := 2000;
+ for j = 0 upto npie:
+% show cmi;
+% show rmost[j];
+ if (not known cmi) or (cmi > rmost[j]):
+ cmi := rmost[j];
+ cmc := j * (rad/nsteps);
+ fi;
+ endfor;
+
+ drawcircle(rad, cmi, cmc);
+
+ ncircles := ncircles +1;
+ coords[ncircles].x := cmi + rad;
+ coords[ncircles].y := cmc;
+ coords[ncircles].h := rad;
+% show "Placed",cmi,cmc,rad;
+enddef;
+
+curx = 0;
+cury = 0;
+maxrad = 0;
+
+vardef addvarcircle(expr rad) =
+ if cury + rad > h:
+ curx := curx + maxrad;
+ cury := 0;
+ maxrad := 0;
+ fi;
+ drawcircle(rad, curx, cury);
+ if rad > maxrad:
+ maxrad := rad;
+ fi;
+ cury := cury + rad;
enddef;
-for i = 1 upto 100:
+for i = 1 upto 2000:
% draw fullcircle scaled (mrad/((i**1.01)**.5)) shifted (.02*mrad*i,100);
- addcircle(mrad / ((i**1.01)**.5));
+ addvarcircle(mrad / ((i**1.05)**.5));
endfor;
picture p;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] manuscripts/Paper Makefile paper.tex zipfarea.mp,
Tuomas J. Lukka <=