 'MET.MSP'
 
command circle (expression h) (expression k) (expression r)
'PLOTS CIRCLE AND REPORTS EQUATION'
  {
   let equation exact eqn (x-h)^2 + (y-k)^2 = r^2;
   plot eqn;
   make answer eqn;
  }
 
command ellipse (expression h) 
'PLOTS ELLIPSE AND REPORTS EQUATION'
  (expression k) (expression a) (expression b)
  {
   let equation exact eqn (x-h)^2/a^2 + (y-k)^2/b^2 = 1;
   plot eqn;
   make answer eqn;
  }
 
command hyperbola (expression h) (expression k) (expression a) (expression b)
'PLOTS HYPERBOLA AND REPORTS EQUATION'
  {
   let equation eqn exact (x-h)^2/a^2 - (y-k)^2/b^2 = 1;
   plot eqn;
   make answer eqn;
  }
 
 
command lin2pt (expression x1) (expression y1) (expression x2) (expression y2)
'PLOTS LINE AND REPORTS EQUATION'
  {
   let eqn exact  y-y1=(y2-y1)/(x2-x1)*(x-x1);
    plot eqn;
   let answer eqn;
  } 
 
 
command lims (expression a) (expression b) (expression c) (expression d)
'QUICK WAY TO CHANGE 2D GRAPH VIEWPORT'
  {
   abscissa a, b;
   graphdomain a, b;
   ordinate c, d;
  }
 
command scale (expression n) 
'QUICKER WAY TO CHANGE 2D GRAPH VIEWPORT'
  {
   abscissa -n, n;
   graphdomain -n, n;
   ordinate -n, n;
  }
 
program factorial (expression num)
'RETURNS FACTORIAL OF NUM'
  {
   let n be 0;
   let ans be 1;
   repeat num
	{
         let n be n+1;
	 let ans be ans*n;
        }
    return ans;
   }
 
program combine (expression total) (expression taken)
'RETURNS NUMBER OF COMBINATIONS:  C(total,taken)'
   {
    if total<taken then {return "Incorrect input"} 
	else 
	{
	let numcombs be 	factorial(total)/(factorial(total-taken)*factorial(taken));
        return d(numcombs)
	}
   }
 
program permute (expression total) (expression taken)
'RETURNS NUMBER OF PERMUATIONS:  P(total,taken)'
   {
    if total<taken then {return "Incorrect input"} 
	else 
	{
         let numperms be factorial(total)/factorial(total-taken)
;
         return d(numperms);
	}
   }
 
make cot(x) cos(x)/sin(x);
make acot(x) pi/2-atan(x);
 
make sec(x) 1/cos(x);
make asec(x) acos(1/x);
 
make csc(x) 1/sin(x);
make acsc(x) asin(1/x);
 
