restart;with(Student[Calculus1]):ApproximateInt(sin(x), x=0..Pi, method=midpoint, output=plot);Notice the above plot is made in to 10 partitions. If we want more, say 5, we can use the following.ApproximateInt(sin(x), x=0..Pi,'partition'=5, method=midpoint, output=plot);We can animate the graph to see how the increase in the number of partitions affects the approximation.ApproximateInt(sin(x), x=0..Pi, output=animation);An interesting variation begins with a random partition, and at each step, chooses a refinement that randomly divides the largest subinterval.ApproximateInt(sin(x), x=0..Pi, partition = random[2], subpartition=width, refinement=random, output=animation, iterations=50);We can also use these commands to calculate the value of the midpoint rule for a partition of 5.ApproximateInt(sin(x), x=0..Pi,'partition'=5, method=midpoint, output=value);evalf(%);