# area approximations and the fundamental theorem

## 2545 days ago by chrisphan

f = lambda x: sin(x) + x/4 - 1/2 plot0 = plot(f, 0, 5.5) plots = [] for N in [2^m for m in range(0, 7)]: deltax = 4/N curplot = plot0 cursum = 0 for j in range(0, N): leftend = 1 + j*deltax rightend = 1 + (j+1)*deltax c = f(rightend) curplot = curplot + polygon([(leftend, 0), (leftend, c), (rightend, c), (rightend,0)], alpha=0.25, rgbcolor=(1, 0, 0)) curplot = curplot + line([(leftend, 0), (leftend, c), (rightend,c), (rightend, 0)], rgbcolor=(0, 1, 0)) cursum = numerical_approx(cursum + deltax*c) curplot = curplot + text("N = " + str(N), (1, 1)) curplot = curplot + text("sum: " + str(numerical_approx(cursum, digits=5)), (3, 1)) plots.append(curplot) rightan = animate(plots) plots = [] for N in [2^m for m in range(0, 7)]: deltax = 4/N curplot = plot0 cursum = 0 for j in range(0, N): leftend = 1 + j*deltax rightend = 1 + (j+1)*deltax c = f(leftend) curplot = curplot + polygon([(leftend, 0), (leftend, c), (rightend, c), (rightend,0)], alpha=0.25, rgbcolor=(1, 0, 0)) curplot = curplot + line([(leftend, 0), (leftend, c), (rightend,c), (rightend, 0)], rgbcolor=(0, 1, 0)) cursum = numerical_approx(cursum + deltax*c) curplot = curplot + text("N = " + str(N), (1, 1)) curplot = curplot + text("sum: " + str(numerical_approx(cursum, digits=5)), (3, 1)) plots.append(curplot) leftan = animate(plots) plots = [] for N in [2^m for m in range(0, 7)]: deltax = 4/N curplot = plot0 cursum = 0 for j in range(0, N): leftend = 1 + j*deltax rightend = 1 + (j+1)*deltax c = f((rightend + leftend)/2) curplot = curplot + polygon([(leftend, 0), (leftend, c), (rightend, c), (rightend,0)], alpha=0.25, rgbcolor=(1, 0, 0)) curplot = curplot + line([(leftend, 0), (leftend, c), (rightend,c), (rightend, 0)], rgbcolor=(0, 1, 0)) cursum = numerical_approx(cursum + deltax*c) curplot = curplot + text("N = " + str(N), (1, 1)) curplot = curplot + text("sum: " + str(numerical_approx(cursum, digits=5)), (3, 1)) plots.append(curplot) midan = animate(plots) html("Let $f(x) = " + latex(f(x)) + "$. Below are right-endpoint, left-endpoint, and midpoint approximations.") show(rightan, delay=100) show(leftan, delay=100) show(midan, delay=100)
 Let f(x) = \frac{1}{4} \, x + \sin\left(x\right) - \frac{1}{2}. Below are right-endpoint, left-endpoint, and midpoint approximations. Let f(x) = \frac{1}{4} \, x + \sin\left(x\right) - \frac{1}{2}. Below are right-endpoint, left-endpoint, and midpoint approximations.
deltax = 4/50 f = lambda x: sin(x) + x/4 - 1/2 plot0 = plot(f, 0, 5.5, ymax = 2) plots = [] curplot = plot0 antider = lambda x: -cos(x) + x^2/8 - x/2 + cos(1) + 3/8 for j in range(0, 50): leftend = 1 + j*deltax rightend = 1 + (j+1)*deltax curplot = curplot + plot(f, leftend, rightend, fill='axis', fillcolor='red', fillalpha=0.25) curplot = curplot + plot(antider, leftend, rightend, rgbcolor=(1, 0, 1)) plots.append(curplot) ftcanim = animate(plots, ymax=2) html("This animation illustrates the fundamental theorem of calculus.") html("In blue is the graph of $f(x) = " + latex(f(x)) + "$,") html("and in magenta is the graph of $F(x)= "+ latex(antider(x)) +"$,") html("an antiderivative of $f$ with $F(1) = 0$.") html("As you can see, $\int_1^b f(x) dx = F(b)$.") show(ftcanim)
 This animation illustrates the fundamental theorem of calculus.In blue is the graph of f(x) = \frac{1}{4} \, x + \sin\left(x\right) - \frac{1}{2},and in magenta is the graph of F(x)= \frac{1}{8} \, x^{2} - \frac{1}{2} \, x + \cos\left(1\right) - \cos\left(x\right) + \frac{3}{8},an antiderivative of f with F(1) = 0.As you can see, \int_1^b f(x) dx = F(b). This animation illustrates the fundamental theorem of calculus.In blue is the graph of f(x) = \frac{1}{4} \, x + \sin\left(x\right) - \frac{1}{2},and in magenta is the graph of F(x)= \frac{1}{8} \, x^{2} - \frac{1}{2} \, x + \cos\left(1\right) - \cos\left(x\right) + \frac{3}{8},an antiderivative of f with F(1) = 0.As you can see, \int_1^b f(x) dx = F(b).
deltax = 5/50 f = lambda x: 1/x plot0 = plot(f, 0.1, 6.5, ymax = 2) plots = [] curplot = plot0 antider = lambda x: log(x) for j in range(0, 50): leftend = 1 + j*deltax rightend = 1 + (j+1)*deltax curplot = curplot + plot(f, leftend, rightend, fill='axis', fillcolor='red', fillalpha=0.25) curplot = curplot + plot(antider, leftend, rightend, rgbcolor=(1, 0, 1)) plots.append(curplot) ftcanim = animate(plots, ymax=2) html("This animation illustrates the fundamental theorem of calculus.") html("In blue is the graph of $f(x) = " + latex(f(x)) + "$,") html("and in magenta is the graph of $y = \ln x$,") html("an antiderivative of $f$.") html("As you can see, $\int_1^x f(t) dt = \ln x$.") show(ftcanim)
 This animation illustrates the fundamental theorem of calculus.In blue is the graph of f(x) = \frac{1}{x},and in magenta is the graph of y = \ln x,an antiderivative of f.As you can see, \int_1^x f(t) dt = \ln x. This animation illustrates the fundamental theorem of calculus.In blue is the graph of f(x) = \frac{1}{x},and in magenta is the graph of y = \ln x,an antiderivative of f.As you can see, \int_1^x f(t) dt = \ln x.