10.2 Limits and Area

489 days ago by mpaul

\lim_{x \rightarrow \infty} f(x) = L

This means that f(x) gets arbitrarily close to L as x gets arbitrarily large.

 
       

Definite Integral

If f(x) is a function defined on the interval [a, b], then

\lim_{n \rightarrow \infty} \sum_{i=1}^{n} f(x_i) \Delta x = \int_a ^b f(x) dx.

(Note - you might think this looks scary, but if you think of it like a programmer, it makes total sense.)

Think of each f(x_i) \Delta x as the area of a rectangle with height f(x_i) and width \Delta x.

The interval [a, b] has been chopped into segments of length \Delta x where each \Delta x = \frac{b-a}{n}.

Each x_i represents an x value in one of those segments.  Each f(x_i) represents the height of the rectangle for that segment.

f(x)=x^2 f 
       
a,b,dx = -3, 3, 1/10 rectangle_areas = [f(x)*dx for x in [a..b, step = dx]] rectangle_areas; sum(rectangle_areas); sum(rectangle_areas).n(digits = 5) 
       
var('x') integral(f,x); integral(f,x,a,b) 
       
f(x) = 1/x #f(x) = x^2 #f(x) = e^(-1/2*x^2)/sqrt(2*pi) #f(x) = 2^x #f(x) = sin(x) var('Trapezoids Rectangles M L R') def trapezoids(f, a, b, dx): domain = [a..b-dx, step = dx] return sum([polygon([(x,0),(x,f(x)),(x+dx,f(x+dx)),(x+dx,0)], \ color = (random(), random(), random())) for x in domain]) def rectangles(f, a, b, dx, RAM = M): def rectangle(RAM, f, x, dx): if RAM == M: P = [(x,0),(x,f(x+dx/2)),(x+dx,f(x+dx/2)),(x+dx,0)] elif RAM == L: P = [(x,0),(x,f(x)),(x+dx,f(x)),(x+dx,0)] elif RAM == R: P = [(x,0),(x,f(x+dx)),(x+dx,f(x+dx)),(x+dx,0)] return polygon(P, color = (random(), random(), random())) return sum([rectangle(RAM,f,x,dx) for x in [a..b-dx, step = dx]]) def heights(f, a, b, dx): return sum([line([(x,0),(x,f(x))], linestyle = '--', color = 'black')\ for x in [a..b, step = dx]]) @interact def _(a=1, b=10, dx=1, method = [None, Trapezoids, Rectangles], RAM = [L, M, R]): display = points([(x,f(x)) for x in [a..b, step = dx]], color = 'red')+\ heights(f, a, b, dx)+plot(f, a, b) if method == Trapezoids: display += trapezoids(f, a, b, dx) elif method == Rectangles: display += rectangles(f, a, b, dx, RAM) x = var('x'); show(f(x)); show(display) if method != None: S = 0 if method == Trapezoids: S = sum([(f(x)+f(x+dx))*dx/2 for x in [a..b-dx, step = dx]]) print 'Sum of areas of trapezoids: ',S.n(digits = 8) if method == Rectangles: if RAM == M: S = sum([f(x+dx/2)*dx for x in [a..b-dx, step = dx]]) elif RAM == L: S = sum([f(x)*dx for x in [a..b-dx, step = dx]]) elif RAM == R: S = sum([f(x+dx)*dx for x in [a..b-dx, step = dx]]) print 'Sum of areas of rectangles: ',S.n(digits = 8) area = f.integral(var('x'), a, b) print 'area: ', area,'=',area.n(digits=8) if method != None: print 'approximate area - actual area:', (S - area).n(digits=8) 
       

Click to the left again to hide and once more to show the dynamic interactive window