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(%); restart; f:=x->exp(-x^2); with(student):with(plots):with(Student[Calculus1]): ApproximateInt(f(x), 0..1, 'partition' = 10, 'method' = right, 'output' = 'animation'); leftbox(f(x),x=0..1,10,shading=cyan); rightbox(f(x),x=0..1,10, shading=blue); middlebox(f(x),x=0..1,10,shading = green); a:=0:b:=1:n:=10: p:=plot(f(x),x=a..b,thickness=3,color=black): c:=array(0..n): for i from 0 to n-1 do c[i]:=polygonplot([[a+i*(b-a)/n,0],[a+(i+1)*(b-a)/n,0],[a+(i+1)*(b-a)/n,f(a+(i+1)*(b-a)/n)],[a+i*(b-a)/n,f(a+i*(b-a)/n)]],color=COLOR(RGB,rand()/10^12,rand()/10^12,rand()/10^12)):od: display({seq(c[i],i=0..n-1),p}); evalf(leftsum(f(x),x=0..1,10)); evalf(rightsum(f(x),x=0..1,10)); evalf(middlesum(f(x),x=0..1,10)); evalf(trapezoid(f(x),x=0..1,10)); evalf(int(f(x),x=0..1)); evalf(simpson(f(x),x=0..1,10));