%output=pdf

\setupcolors[state=start]

\definecolor[gridlines][s=0.7]

\startMPinclusions

warningcheck:=0;

color gridlines; gridlines:=\MPcolor{gridlines};

vardef create_grid (expr l,r,h,b,t,v,wid,ht)=
  save ux, uy; numeric ux, uy;
  (r-l)*ux=wid; (t-b)*uy=ht;
  for k=b step v until t:
    draw (l*ux,k*uy)--(r*ux,k*uy) withcolor \MPcolor{gridlines};
  endfor;
  for k=l step h until r:
    draw (k*ux,b*uy)--(k*ux,t*uy) withcolor \MPcolor{gridlines};
  endfor;
enddef;

vardef create_axes (expr l,r,b,t,wid,ht,blbl) (text xlbl,ylbl) =
  save ux, uy; numeric ux, uy;
  (r-l)*ux=wid; (t-b)*uy=ht;
  textextoffset:=3pt;
  drawdblarrow (1.05*l*ux,0)--(1.05*r*ux,0);
  draw textext.rt(xlbl) shifted (1.05*r*ux,0);
  if blbl:draw textext.bot(decimal r) shifted (r*ux,0); fi;
  drawdblarrow (0,1.05*b*uy)--(0,1.05*t*uy);
  draw textext.top(ylbl) shifted (0,1.05*t*uy);
  if blbl: draw textext.lft(decimal t) shifted (0,t*uy); fi;
enddef;

vardef drawfcn (expr ind,dep,l,r,b,t,wid,ht,n,st,fin) text txt =
  save x, dx, ux, uy; numeric x, dx, ux, uy;
  dx:=(r-l)/n;
  (r-l)*ux=wid; (t-b)*uy=ht;
  save cpath; path cpath; cpath:=(l,b)--(r,b)--(r,t)--(l,t)--cycle;
  save p; path p; hide (x:=st;) p:=(scantokens(ind),scantokens(dep));
  for xx:=st step dx until fin:
    hide (x:=xx;) p:=p--(scantokens(ind),scantokens(dep));
  endfor;
  hide(x:=fin;) p:=p--(scantokens(ind),scantokens(dep));
  p:=p cutbefore cpath;
  p:=reverse p;
  p:=p cutbefore cpath;
  p:=p xyscaled (ux,uy);
  drawdblarrow p txt;
enddef;

\stopMPinclusions

\starttext


\startMPpage %figure library name: yeq1overx1

%initialize window parameters
numeric xmin, xmax, xscl, ymin, ymax, yscl;
xmin:=-10;
xmax:=10;
xscl:=1;
ymin:=-10;
ymax:=10;
yscl:=1;

%initialize number of points
numeric num_points;
num_points:=100;

%initialize dimensions of image
numeric width, height;
width=2in; 
height=2in;

%create the grid
create_grid(xmin,xmax,xscl,ymin,ymax,yscl,width,height);

boolean lbl_scl; lbl_scl:=true;

%create the axes
create_axes(xmin,xmax,ymin,ymax,width,height,lbl_scl)("$x$")("$y$");

%draw the function
%drawfcn("x","1/x",xmin,xmax,ymin,ymax,width,height,100,xmin,xmax)
%withcolor blue ;

%define function
vardef f(expr x)=
 1/x
enddef;

%initialize scale
numeric ux, uy; (xmax-xmin)*ux=width; (ymax-ymin)*uy=height;

%plot some points
pickup pencircle scaled 3pt;
drawdot ((-3,f(-3)) xyscaled(ux,uy)) withcolor blue;
drawdot ((-2,f(-2)) xyscaled(ux,uy)) withcolor blue;
drawdot ((-1,f(-1)) xyscaled(ux,uy)) withcolor blue;
drawdot ((1,f(1)) xyscaled(ux,uy)) withcolor blue;
drawdot ((2,f(2)) xyscaled(ux,uy)) withcolor blue;
drawdot ((3,f(3)) xyscaled(ux,uy)) withcolor blue;
pickup defaultpen;

\stopMPpage


\startMPpage %figure library name: horizasymptote

%initialize window parameters
numeric xmin, xmax, xscl, ymin, ymax, yscl;
xmin:=-10;
xmax:=10;
xscl:=1;
ymin:=-10;
ymax:=10;
yscl:=1;

%initialize number of points
numeric num_points;
num_points:=100;

%initialize dimensions of image
numeric width, height;
width=2in; 
height=2in;

%create the grid
create_grid(xmin,xmax,xscl,ymin,ymax,yscl,width,height);

boolean lbl_scl; lbl_scl:=true;

%create the axes
create_axes(xmin,xmax,ymin,ymax,width,height,lbl_scl)("$x$")("$y$");

%define function
vardef f(expr x)=
 1/x
enddef;

%initialize scale
numeric ux, uy; (xmax-xmin)*ux=width; (ymax-ymin)*uy=height;

%draw each branch of the function
path pleft, pright;

%left branch
pleft:=(-10,f(-10));
for x=-10 step .1 until -1:
  pleft:=pleft--(x,f(x));
endfor;
pleft:=pleft--(-1,f(-1));
pleft:=pleft xyscaled(ux,uy);
drawarrow reverse pleft withcolor blue;

%right branch
pright:=(1,f(1));
for x=1 step .1 until 10:
  pright:=pright--(x,f(x));
endfor;
pright:=pright--(10,f(10));
pright:=pright xyscaled(ux,uy);
drawarrow pright withcolor blue;


\stopMPpage

\startMPpage %figure library name: zeroright

%initialize window parameters
numeric xmin, xmax, xscl, ymin, ymax, yscl;
xmin:=-10;
xmax:=10;
xscl:=1;
ymin:=-10;
ymax:=10;
yscl:=1;

%initialize number of points
numeric num_points;
num_points:=100;

%initialize dimensions of image
numeric width, height;
width=2in; 
height=2in;

%create the grid
create_grid(xmin,xmax,xscl,ymin,ymax,yscl,width,height);

boolean lbl_scl; lbl_scl:=true;

%create the axes
create_axes(xmin,xmax,ymin,ymax,width,height,lbl_scl)("$x$")("$y$");

%define function
vardef f(expr x)=
 1/x
enddef;

%initialize scale
numeric ux, uy; (xmax-xmin)*ux=width; (ymax-ymin)*uy=height;

%draw each branch of the function
path pleft, pright;

%left branch
pleft:=(-10,f(-10));
for x=-10 step .1 until -1:
  pleft:=pleft--(x,f(x));
endfor;
pleft:=pleft--(-1,f(-1));
pleft:=pleft xyscaled(ux,uy);
drawarrow reverse pleft withcolor blue;

%right branch
pright:=(1,f(1));
for x=1 step .1 until 10:
  pright:=pright--(x,f(x));
endfor;
pright:=pright--(10,f(10));
pright:=pright xyscaled(ux,uy);
drawarrow pright withcolor blue;

%plot additional points
pickup pencircle scaled 3pt;
drawdot ((1/2,f(1/2)) xyscaled(ux,uy));
drawdot ((1/4,f(1/4)) xyscaled(ux,uy));
drawdot ((1/8,f(1/8)) xyscaled(ux,uy));
pickup defaultpen;
\stopMPpage


\startMPpage %figure library name: zeroleft

%initialize window parameters
numeric xmin, xmax, xscl, ymin, ymax, yscl;
xmin:=-10;
xmax:=10;
xscl:=1;
ymin:=-10;
ymax:=10;
yscl:=1;

%initialize number of points
numeric num_points;
num_points:=100;

%initialize dimensions of image
numeric width, height;
width=2in; 
height=2in;

%create the grid
create_grid(xmin,xmax,xscl,ymin,ymax,yscl,width,height);

boolean lbl_scl; lbl_scl:=true;

%create the axes
create_axes(xmin,xmax,ymin,ymax,width,height,lbl_scl)("$x$")("$y$");

%define function
vardef f(expr x)=
 1/x
enddef;

%initialize scale
numeric ux, uy; (xmax-xmin)*ux=width; (ymax-ymin)*uy=height;

%draw each branch of the function
path pleft, pright;

%left branch
pleft:=(-10,f(-10));
for x=-10 step .1 until -1:
  pleft:=pleft--(x,f(x));
endfor;
pleft:=pleft--(-1,f(-1));
pleft:=pleft xyscaled(ux,uy);
drawarrow reverse pleft withcolor blue;

%right branch
pright:=(1,f(1));
for x=1 step .1 until 10:
  pright:=pright--(x,f(x));
endfor;
pright:=pright--(10,f(10));
pright:=pright xyscaled(ux,uy);
drawarrow pright withcolor blue;

%plot additional points
pickup pencircle scaled 3pt;
drawdot ((-1/2,f(-1/2)) xyscaled(ux,uy));
drawdot ((-1/4,f(-1/4)) xyscaled(ux,uy));
drawdot ((-1/8,f(-1/8)) xyscaled(ux,uy));
pickup defaultpen;
\stopMPpage


\startMPpage %figure library name: yeq1overx

%initialize window parameters
numeric xmin, xmax, xscl, ymin, ymax, yscl;
xmin:=-10;
xmax:=10;
xscl:=1;
ymin:=-10;
ymax:=10;
yscl:=1;

%initialize number of points
numeric num_points;
num_points:=100;

%initialize dimensions of image
numeric width, height;
width=2in; 
height=2in;

%create the grid
create_grid(xmin,xmax,xscl,ymin,ymax,yscl,width,height);

boolean lbl_scl; lbl_scl:=true;

%create the axes
create_axes(xmin,xmax,ymin,ymax,width,height,lbl_scl)("$x$")("$y$");

%define function
vardef f(expr x)=
 1/x
enddef;

%initialize scale
numeric ux, uy; (xmax-xmin)*ux=width; (ymax-ymin)*uy=height;

%draw each branch of the function
path pleft, pright;

%left branch
pleft:=(-10,f(-10));
for x=-10 step .1 until -1:
  pleft:=pleft--(x,f(x));
endfor;
pleft:=pleft--(-1,f(-1));
pleft:=pleft xyscaled(ux,uy);
drawarrow reverse pleft withcolor blue;

%right branch
pright:=(1,f(1));
for x=1 step .1 until 10:
  pright:=pright--(x,f(x));
endfor;
pright:=pright--(10,f(10));
pright:=pright xyscaled(ux,uy);
drawarrow pright withcolor blue;

%further left and right branches
path qleft, qright;
qleft:=(-1,f(-1));
for x=-1 step .005 until -0.1:
  qleft:=qleft--(x,f(x));
endfor;
qleft:=qleft--(-0.1,f(-0.1));
qleft:=qleft xyscaled(ux,uy);
drawarrow qleft withcolor blue;

qright:=(1,f(1));
for x=1 step -.005 until 0.1:
  qright:=qright--(x,f(x));
endfor;
qright:=qright--(0.1,f(0.1));
qright:=qright xyscaled(ux,uy);
drawarrow qright withcolor blue;

\stopMPpage


\startMPpage %figure library name: yeq1overxplus3minus4

%initialize window parameters
numeric xmin, xmax, xscl, ymin, ymax, yscl;
xmin:=-10;
xmax:=10;
xscl:=1;
ymin:=-10;
ymax:=10;
yscl:=1;

%initialize number of points
numeric num_points;
num_points:=100;

%initialize dimensions of image
numeric width, height;
width=2in; 
height=2in;

%create the grid
create_grid(xmin,xmax,xscl,ymin,ymax,yscl,width,height);

boolean lbl_scl; lbl_scl:=true;

%create the axes
create_axes(xmin,xmax,ymin,ymax,width,height,lbl_scl)("$x$")("$y$");

%define function
vardef f(expr x)=
 1/(x+3)
enddef;

%initialize scale
numeric ux, uy; (xmax-xmin)*ux=width; (ymax-ymin)*uy=height;

%draw each branch of the function
path pleft, pright;

%left branch
pleft:=(-10,f(-10));
for x=-10 step .05 until -3.1:
  pleft:=pleft--(x,f(x));
endfor;
pleft:=pleft--(-3.1,f(-3.1));
pleft:=pleft xyscaled(ux,uy);
drawdblarrow pleft withcolor blue;

%right branch
pright:=(-2.9,f(-2.9));
for x=-2.9 step .05 until 10:
  pright:=pright--(x,f(x));
endfor;
pright:=pright--(10,f(10));
pright:=pright xyscaled(ux,uy);
drawdblarrow pright withcolor blue;

%asymptotes
draw (-3ux,-10uy)--(-3ux,10uy) dashed evenly;

\stopMPpage



\startMPpage %figure library name: yeq1overxplus3minus4

%initialize window parameters
numeric xmin, xmax, xscl, ymin, ymax, yscl;
xmin:=-10;
xmax:=10;
xscl:=1;
ymin:=-10;
ymax:=10;
yscl:=1;

%initialize number of points
numeric num_points;
num_points:=100;

%initialize dimensions of image
numeric width, height;
width=2in; 
height=2in;

%create the grid
create_grid(xmin,xmax,xscl,ymin,ymax,yscl,width,height);

boolean lbl_scl; lbl_scl:=true;

%create the axes
create_axes(xmin,xmax,ymin,ymax,width,height,lbl_scl)("$x$")("$y$");

%define function
vardef f(expr x)=
 1/(x+3)-4
enddef;

%initialize scale
numeric ux, uy; (xmax-xmin)*ux=width; (ymax-ymin)*uy=height;

%draw each branch of the function
path pleft, pright;

%left branch
pleft:=(-10,f(-10));
for x=-10 step .05 until -3.1667:
  pleft:=pleft--(x,f(x));
endfor;
pleft:=pleft--(-3.1667,f(-3.1667));
pleft:=pleft xyscaled(ux,uy);
drawdblarrow pleft withcolor blue;

%right branch
pright:=(-2.9286,f(-2.9286));
for x=-2.9286 step .05 until 10:
  pright:=pright--(x,f(x));
endfor;
pright:=pright--(10,f(10));
pright:=pright xyscaled(ux,uy);
drawdblarrow pright withcolor blue;

%asymptotes
draw (-3ux,-10uy)--(-3ux,10uy) dashed evenly;
draw (-10ux,-4uy)--(10ux,-4uy) dashed evenly;

\stopMPpage


\startMPpage %figure library name: yeqminus2overx

%initialize window parameters
numeric xmin, xmax, xscl, ymin, ymax, yscl;
xmin:=-10;
xmax:=10;
xscl:=1;
ymin:=-10;
ymax:=10;
yscl:=1;

%initialize number of points
numeric num_points;
num_points:=100;

%initialize dimensions of image
numeric width, height;
width=2in; 
height=2in;

%create the grid
create_grid(xmin,xmax,xscl,ymin,ymax,yscl,width,height);

boolean lbl_scl; lbl_scl:=true;

%create the axes
create_axes(xmin,xmax,ymin,ymax,width,height,lbl_scl)("$x$")("$y$");

%define function
vardef f(expr x)=
 -2/x
enddef;

%initialize scale
numeric ux, uy; (xmax-xmin)*ux=width; (ymax-ymin)*uy=height;

%draw each branch of the function
path pleft, pright;

%left branch
pleft:=(-10,f(-10));
for x=-10 step .1 until -0.2:
  pleft:=pleft--(x,f(x));
endfor;
pleft:=pleft--(-0.2,f(-0.2));
pleft:=pleft xyscaled(ux,uy);
drawdblarrow pleft withcolor blue;

%right branch
pright:=(0.2,f(0.2));
for x=0.2 step .1 until 10:
  pright:=pright--(x,f(x));
endfor;
pright:=pright--(10,f(10));
pright:=pright xyscaled(ux,uy);
drawdblarrow pright withcolor blue;

\stopMPpage

\startMPpage %figure library name: yeqminus2overxminus4plus3

%initialize window parameters
numeric xmin, xmax, xscl, ymin, ymax, yscl;
xmin:=-10;
xmax:=10;
xscl:=1;
ymin:=-10;
ymax:=10;
yscl:=1;

%initialize number of points
numeric num_points;
num_points:=100;

%initialize dimensions of image
numeric width, height;
width=2in; 
height=2in;

%create the grid
create_grid(xmin,xmax,xscl,ymin,ymax,yscl,width,height);

boolean lbl_scl; lbl_scl:=true;

%create the axes
create_axes(xmin,xmax,ymin,ymax,width,height,lbl_scl)("$x$")("$y$");

%define function
vardef f(expr x)=
 -2/(x-4)+3
enddef;

%initialize scale
numeric ux, uy; (xmax-xmin)*ux=width; (ymax-ymin)*uy=height;

%draw each branch of the function
path pleft, pright;

%left branch
pleft:=(-10,f(-10));
for x=-10 step .1 until 3.7143:
  pleft:=pleft--(x,f(x));
endfor;
pleft:=pleft--(3.7243,f(3.7143));
pleft:=pleft xyscaled(ux,uy);
drawdblarrow pleft withcolor blue;

%right branch
pright:=(4.1538,f(4.1538));
for x=4.1538 step .1 until 10:
  pright:=pright--(x,f(x));
endfor;
pright:=pright--(10,f(10));
pright:=pright xyscaled(ux,uy);
drawdblarrow pright withcolor blue;

%asymptotes
draw (4ux,-10uy)--(4ux,10uy) dashed evenly;
draw (-10ux,3uy)--(10ux,3uy) dashed evenly;

\stopMPpage

\startMPpage %figure library name: yeq1overx1

%initialize window parameters
numeric xmin, xmax, xscl, ymin, ymax, yscl, start, finish;
xmin:=-10;
xmax:=10;
xscl:=1;
ymin:=-50;
ymax:=50;
yscl:=5;
start:=-6;
finish:=6;

%initialize number of points
numeric num_points;
num_points:=100;

%initialize dimensions of image
numeric width, height;
width=2in; 
height=2in;

%create the grid
create_grid(xmin,xmax,xscl,ymin,ymax,yscl,width,height);

boolean lbl_scl; lbl_scl:=true;

%create the axes
create_axes(xmin,xmax,ymin,ymax,width,height,lbl_scl)("$x$")("$y$");

%draw the function
drawfcn("x","(x+4)*(x-1)*(x-3)",xmin,xmax,ymin,ymax,width,height,100,start,finish)
withcolor blue ;

\stopMPpage

\startMPpage %figure library name: sec1q1

%initialize window parameters
numeric xmin, xmax, xscl, ymin, ymax, yscl;
xmin:=-10;
xmax:=10;
xscl:=1;
ymin:=-10;
ymax:=10;
yscl:=1;

%initialize number of points
numeric num_points;
num_points:=100;

%initialize dimensions of image
numeric width, height;
width=1.5in; 
height=1.5in;

%create the grid
create_grid(xmin,xmax,xscl,ymin,ymax,yscl,width,height);

boolean lbl_scl; lbl_scl:=true;

%create the axes
create_axes(xmin,xmax,ymin,ymax,width,height,lbl_scl)("$x$")("$y$");

%define function
vardef f(expr x)=
 -2/x
enddef;

%initialize scale
numeric ux, uy; (xmax-xmin)*ux=width; (ymax-ymin)*uy=height;

%draw each branch of the function
path pleft, pright;

%left branch
pleft:=(-10,f(-10));
for x=-10 step .1 until -0.2:
  pleft:=pleft--(x,f(x));
endfor;
pleft:=pleft--(-0.2,f(-0.2));
pleft:=pleft xyscaled(ux,uy);
drawdblarrow pleft withcolor blue;

%right branch
pright:=(0.2,f(0.2));
for x=0.2 step .1 until 10:
  pright:=pright--(x,f(x));
endfor;
pright:=pright--(10,f(10));
pright:=pright xyscaled(ux,uy);
drawdblarrow pright withcolor blue;

%asymptotes
draw (0ux,-10uy)--(0ux,10uy) dashed evenly;
draw (-10ux,0uy)--(10ux,0uy) dashed evenly;

%annotations
label.bot(btex $\tfx y=0$ etex, (-10ux,0));
label.lft(btex $\tfx x=0$ etex, (0,-10uy));

\stopMPpage


\stoptext

%%% Local Variables:
%%% mode: conTeXt-en
%%% End:

