Calculus I
Lesson 23: The Meaning of Area Under a Curve
Positive & Negative Area
First we'll look at the concept of area under a curve and see how it can be both positive and negative. To investigate this idea we will use the special plot procedure below. Type it in precisely as you see it a single comand plot.
> area_plot := proc(f1,a,b) local box,i,n,x1,x2,y1,y2,A,delta: n:= 2; delta := (b-a)/n; x2 := a; for i from 1 to n do x1 := evalf(x2); y1 := evalf(f1(x1)); x2 := evalf(a + i*delta); y2 := evalf(f1(x2)); if( y1 > 0 ) then A||i :=polygonplot( [[x1,0],[x1,y1],[x2,y2],[x2,0]],color=coral,style=patchnogrid); else A||i:=polygonplot( [[x1,0],[x1,y1],[x2,y2],[x2,0]],color=red, style=patchnogrid); fi; od; display([plot(f1(x), x = a..b, color=blue,thickness=2,discont=true), seq(A||i,i=1..n)]); end:
To use this new function, define a function, and the left and right end points of an interval. In this case, we will view the area between x = 1 and x = 3. The area is measured between the x-axis and the graph of the function.
> with(plots):
> f := x -> 1 + x/2 + (x/3)*sin(x^2); a := 1; b := 3;
> area_plot( f, a, b );
Area can be both positive and negative. Area is positive when y values are positive, and negative when y is negative.
> f := x->x^2 + 3;
> area_plot( f, -2, 2); area_plot( -f, -2, 2);
In many cases, there are regions where the curve weaves above and below the x axis. The regions above lead to positive areas, and the regions below make negative areas.
> f := x-> 10 + 6*x - x^2; a := -3; b := 9; area_plot( f, a,b );
Integrable Functions
Although a function needs to be both continuous and smooth to be differentiable, the area can still be clearly defined even for functions which are neither smooth nor continuous. Such functions are termed integrable for reasons which will be clear in the near future.
Area also applies to discontinuous, piecewise defined functions, and functions which are not differentiable everywhere.
> f:= x -> piecewise( x < 2, -1, x<6, 2-x/2, x < 8, .5*x^2 - 6*x + 18, 1);
> a:=0; b := 10; area_plot( f(x), a, b );
> f := x-> sqrt( abs(x^2 - 9 )) - 2; a := -5; b := 5; area_plot( f(x), a, b );