blob: 96e71812c014a43628236fd1f0b097731111516c (
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$","$\lfloor x\rfloor$",red);
dot(Close);
dot(Open,UnFill);
|