blob: ed61c0e873037c676bbb093654c1beeaca5ecc1a (
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
|
import graph;
unitsize(1cm);
real Floor(real x) {return floor(x);}
pair[] Close;
pair[] Open;
bool3 branch(real x) {
static real lasty;
static bool first=true;
real y=floor(x);
bool samebranch=first || lasty == y;
first=false;
if(samebranch) lasty=x;
else {
Close.push((x,lasty));
Open.push((x,y));
}
lasty=y;
return samebranch ? true : default;
};
draw(graph(Floor,-5.5,5.5,500,branch));
axes("$x$",rotate(0)*"$\lfloor x\rfloor$",red);
dot(Close);
dot(Open,UnFill);
|