I am having difficulty with filling the area between two curves. I am trying to write several examples for my students to do. Below I have two figures, of which the first, I have figured out how to shade using \pscustom. However, I can't figure out the second graph. I need the area filled on the interval from (0,1) and (1,2).
Any help would be appreciated
Nick
Code: Select all
\documentclass{exam}
\usepackage{pst-plot}
\pagestyle{empty}
\begin{document}
\psset{unit=.65,arrowinset=0,arrowsize=8pt}
\psframebox[fillstyle=solid,fillcolor=black!10,framesep=0pt]{%
\begin{pspicture*}(-6,-10)(6,8.5)
\pscustom[fillstyle=solid,fillcolor=blue!20,linestyle=none,algebraic]{%
\psplot{-4}{3}{x^2-9}
}
\psplot[arrowinset=0,arrowsize=8pt,linewidth=2pt,algebraic,linecolor=red,arrows=<->]{-4.75}{5}{3-x}
\psplot[arrowinset=0,arrowsize=8pt,linewidth=2pt,algebraic,linecolor=blue,arrows=<->]{-4.15}{4}{x^2-9}
\psaxes[arrowinset=0,arrowsize=8pt]{<->}(0,0)(-6,-10)(5,8)[$x$,-90][$y$,0]
\end{pspicture*}}
\psset{unit=3,arrowinset=0,arrowsize=8pt}
\psframebox[fillstyle=solid,fillcolor=black!10,framesep=0pt]{%
\begin{pspicture*}(-3,-5)(6,6)
\pscustom[fillstyle=solid,fillcolor=blue!20,linestyle=none,algebraic]{%
\psplot{0}{1}{x^2}
\psplot{0}{1}{2-x^2}
}
\psplot[arrowinset=0,arrowsize=8pt,linewidth=2pt,algebraic,linecolor=red]{0}{2}{x^2}
\psplot[arrowinset=0,arrowsize=8pt,linewidth=2pt,algebraic,linecolor=blue]{0}{2}{2-x^2}
\psaxes[arrowinset=0,arrowsize=8pt]{<->}(0,0)(-2,-2)(5,5)[$x$,-90][$y$,0]
\end{pspicture*}}
\end{document}