View TeX code
% !TEX TS-program = lualatex
\documentclass[border=12pt]{standalone}
\usepackage{tkz-fn}
\begin{document}
\begin{tikzpicture}[scale=0.8]
\tkzFnInit[xmin=-3,xmax=6,ymin=-2,ymax=14,ystep=2]
\tkzFnAxes[ticks=false]
\tkzFnDef{f}{(-x-2)*(x-5)}
\tkzFnRiemann[method=sup,fill=blue!30,opacity=.5,interval=-1:5](f)
\tkzFnRiemann[method=inf,fill=green!40,opacity=.6,interval=-1:5](f)
\tkzFnDraw[line width=1.5pt,red,domain=-2.4:5.4](f)
\tkzFnText[align=left](7.5,10){%
$n=10$ on $[-1;5]$\\[2pt]
lower sum: $\tkzFnPrint{riemann(f,-1,5,10,"inf")}$\\
upper sum: $\tkzFnPrint{riemann(f,-1,5,10,"sup")}$\\
integral: $\tkzFnPrint{integral(f,-1,5)}$}
\end{tikzpicture}
\end{document}