blob: 56e5212ae1897dcb1e566493e10a0f53b628f6e3 (
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
29
30
31
32
33
34
35
36
37
|
func Fx
ret (arg0 * arg0)
end
# graph area
set plotx 0
set ploty 0
set plotw 479
set ploth 319
# graph range
set xmin (0 - 10)
set xmax 10
set ymin (0 - 10)
set ymax 10
set xinc (plotw / (xmax - xmin))
set yinc (ploth / (ymax - ymin))
# print axis
line 240 0 240 319 32767
line 0 160 479 160 32767
# do function
set x xmin
set cx (plotx + (plotw / 2))
set cy (ploty + (ploth / 2))
do
Fx x > y
set y (0 - y)
if ((y > ymin) & (y < ymax))
pixel (cx + (x * xinc)) (cy + (y * yinc)) 511
end
set x (x + (1 / xinc))
while (x < xmax)
print "Done."
|