function out = viewSolid(zvar, F, G, yvar, f, g, xvar, a, b)
%VIEWSOLID is a version for Matlab of the routine on page 161
%  of "Multivariable Calculus and Mathematica" for viewing the region
%  bounded by two surfaces for the purpose of setting up triple integrals. 
%  The arguments are entered from the inside out.  
%  The variable xvar (x, for example) is on the 
%  OUTSIDE of the triple integral, and goes between CONSTANT limits a and b.
%  The variable yvar goes in the MIDDLE of the triple integral, and goes 
%  between limits which must be expressions in one variable [xvar].
%  The variable zvar goes in the INSIDE of the triple integral, and goes
%  between limits which must be expressions in two 
%  variables [xvar and yvar].  The lower surface is plotted in red, the
%  upper one in blue, and the "hatching" in cyan.
%
% Examples: viewSolid(z, 0, (x+y)/4, y, x/2, x, 1, 2,)
% gives the picture on page 163 of "Multivariable Calculus and Mathematica"  
% and the picture on page 164 of "Multivariable Calculus and Mathematica"
% can be produced by
%     viewSolid(z, x^2+3*y^2, 4-y^2, y, -sqrt(4-x^2)/2, sqrt(4-x^2)/2, ...
%               x, -2, 2,)
%
ffun=inline(vectorize(f-xvar+xvar),char(xvar));
gfun=inline(vectorize(g-xvar+xvar),char(xvar));
Ffun=inline(vectorize(F-xvar-yvar+xvar+yvar),char(xvar),char(yvar));
Gfun=inline(vectorize(G-xvar-yvar+xvar+yvar),char(xvar),char(yvar));
oldviewSolid(char(xvar), double(a), double(b), ...
   char(yvar), ffun, gfun, char(zvar), Ffun, Gfun)
