Exploring the integral

Task
Display the upper and lower sum of a function to explore the integral. [br][br]Explore the construction and learn how to create an applet for exploring the integral with [i][url=https://www.geogebra.org/calculator][i]GeoGebra Calculator Suite[/i][/url][/i]. Then try it yourself by following the instructions below.
Explore the construction...
Instructions
[table][tr][td]1.[/td][td][/td][td]Enter the function [math]f(x)=(x+2)(x-1)^2+2[/math] into the [i]Input Bar [/i]to draw its graph.[/td][/tr][tr][td]2.[/td][td][icon]https://www.geogebra.org/images/ggb/toolbar/mode_point.png[/icon][/td][td]Create points [i]A[/i] and [i]B[/i] on the x-axis by selecting the [i]Point [/i]tool and clicking on the x-axis.[/td][/tr][tr][td]3.[/td][td][/td][td]Enter the parameter [math]\text{n}[/math] into the [i]Input Bar [/i]and press [i]Enter[/i]. A slider for [i]n[/i] will be created automatically.[/td][/tr][tr][td]4.[/td][td][/td][td]Open the context menu by pressing the [i]More [/i]button of the slider and go to [i]Settings [/i]to change the range from 1 to 50 and increment to 1.[/td][/tr][tr][td]5.[/td][td][/td][td]Enter the command [math]UpperSum(f,x(A),x(B),n)[/math] to graph the upper sum in the [i]Graphics View[/i].[/td][/tr][tr][td]6.[/td][td][/td][td]Move the slider to change the number of intervals for the upper sum.[/td][/tr][tr][td]7.[/td][td][/td][td]Hide the upper sum by selecting the enabled [i]Visibility [/i]button on the left in the [i]Algebra View[/i].[/td][/tr][tr][td]8.[/td][td][/td][td]Enter the command [math]LowerSum(f,x(A),x(B),n)[/math] into the [i]Input Bar [/i]to graph the lower sum.[/td][/tr][tr][td]9.[/td][td][/td][td]Move the slider again to change the number of intervals for the lower sum.[/td][/tr][tr][td]10.[/td][td][/td][td]Show the upper sum again, move the slider for the number of intervals and compare both values.[br][b]Note:[/b] Change the colors of the upper and lower sum to compare them in the [i]Graphics View.[br][/i][/td][/tr][/table]
Try it yourself...
Instructions (continued)
[table][tr][td]11.[/td][td][/td][td]Hide the lower and upper sum again by selecting the [i]Visibility [/i]buttons. [/td][/tr][tr][td]12.[/td][td][/td][td]Enter the command [math]Integral(f,x(A),x(B))[/math] to display the area between [i]f(x)[/i] and the x-axis in this interval.[/td][/tr][tr][td]13.[/td][td][/td][td]Show the upper and lower sum again and move the slider.[br][b]Note:[/b] Change the color of the integral to compare them in the [i]Graphics View.[/i][/td][/tr][tr][td]14.[/td][td][/td][td]Compare the values of the lower and upper sum with the integral when moving the slider to its maximum and explore how they get closer to the integral value.[br][/td][/tr][/table]

Information: Exploring the integral