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