home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS - Coast to Coast
/
simteldosarchivecoasttocoast2.iso
/
calculat
/
sm30a.zip
/
DOTPLOT.(X)
< prev
next >
Wrap
Text File
|
1993-11-14
|
796b
|
30 lines
# plot y=f(x) with dots on xy-plane
# by default xmin:=-5, xmax:=5, ymin:=-5, ymax:=5
# e.g. dotplot(x^3,x)
dotplot(y_, x_, xmin_, xmax_, ymin_, ymax_) := block(numeric:=on,
dx:=(xmax-xmin)/getmaxx,
dy:=(ymax-ymin)/getmaxy,
xstep:=dx*10,
graph,
line(40,getmaxy-30,getmaxx,getmaxy-30),
line(40,0,40,getmaxy-30),
moveto(0,0),
writes(ymax),
moveto(0,getmaxy-30),
writes(ymin),
moveto(40,getmaxy-20),
writes(xmin),
moveto(getmaxx-30,getmaxy-20),
writes(xmax),
setviewport(40,0,getmaxx,getmaxy-30,1),
moveto(0,getmaxy-30),
do( putpixel((x-xmin)/dx,getmaxy-30-(y-ymin)/dy,15),
x,xmin,xmax,xstep),
numeric:=off,
readchar,
text,
local(dx,dy,xstep))
dotplot(y_, x_, xmin_, xmax_) := dotplot(y,x,xmin,xmax,-5,5)
dotplot(y_, x_) := dotplot(y,x,-5,5,-5,5)