%! % set units to inches 72 dup scale 1 72 div setlinewidth 2 2 translate % draw some axes 0.7 setgray newpath -1 0 moveto 2 0 lineto 0 -1 moveto 0 2 lineto stroke 0 setgray % x is the only argument for f = x^2 /f { 1 dict begin % magic % the "1" here is the number of definition s made within this procedure /x exch def % % x is now the single argument to the function x x mul % the line above is the only one specific to this fumnction end % magic } def % the graph will be made up of N line segments /N 100 def /x0 0 def % initial x /xf 1 def % final x /x x0 def /dx xf x0 sub N div def newpath x x f moveto % start at the initial value of (x, y) N { /x x dx add def % update x x x f lineto } repeat stroke showpage