- Riemann Sums:
This animation shows the Riemann sum defined by the midpoint rule.
To see the left or right Riemann sums, change the command "middlebox" to either "leftbox" or "rightbox" respectively.
restart: with(plots): with(student):
a := 0: b := 2: # domain
m := 5: n := 20: # start boxes, frames
f := x -> exp(-x^2): # function
if m < 1 then m := 1: end if:
for i from m to m+n-1
do an1[i] := middlebox(f(x),x=a..b, i):
end do:
an2 := [seq(an1[i],i=m..m+n-1)]:
display(an2,insequence=true);
- The Integral Function:
The animation shows the process of creating the integral function by slowly filling in area under the curve and simultaneously drawing the curve representing the total area thus far, i.e. it is a visual representation of the First Fundamental Theorem of Calculus.
restart: with(plots):
a := -1: b := 2: # domain
c := -.5: d := 1.5: # range
n := 20: # frames
f := x -> exp(-x^2)-.2: # function
g := x -> value(Int(f(t),t=a..x)): # integral function
an1 := plot(f(x),x=a..b, view=[a..b,c..d], color=BLUE):
for i from 1 to n do
k := a+(b-a)*i/n:
an2[i] := plot(f(x),x=a..k,filled=true,view=[a..b,c..d],
color=AQUAMARINE):
an3[i] := plot(g(x),x=a..k,view=[a..b,c..d],color=RED):
end do:
an4 := plots[display]([seq(an2[i],i=1..n)],insequence=true):
an5 := plots[display]([seq(an3[i],i=1..n)],insequence=true):
display(an1,an4,an5);
- Arc Length:
This animation shows the idea used to find the arc length of a curve.
The curve is broken into subsections, each of which is approximated by a straight line.
At first the curve and the line segments don't look anything alike, but very soon it becomes difficult to tell them apart, except for sections of high curvature.
restart: with(plots):
a := -1: b := 2: # domain
c := -2: d := 1.5: n := 12: # range, frames
f := x -> sin(3*x)+cos(5*x): # function
Lf := proc(a,b,f,k,x) # piecewise linear procedure
local i,delta:
delta:=(b-a)/k;
if x<=a then f(a)+ (x-a)*(f(a+delta)-f(a))/delta
elif x>b then f(b)+(x-b)*(f(b)-f(b-delta))/delta
else
for i from 0 while ((a+i*delta) < x)
do
if (x <= (a+(i+1)*delta)) then
((f(a+(i+1)*delta)-f(a+i*delta))/delta)
*(x-(a+i*delta))+f(a+i*delta)
end if:
end do:
end if:
end proc:
an1:=plot(f(x),x=a..b,view=c..d,color=BLUE):
for k from 1 to n do
L:=x->Lf(a,b,f,k,x):
an2[k]:=plot(L,a..b,view=c..d,tickmarks=[0,0]):
end do:
an3 := plots[display]([seq(an2[k],k=1..n)],insequence=true):
display(an1,an3);