Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168731
Image: ubuntu2004

We want to take care about the Integration in the following worksheet. As we already know the meaning of the differentiation, which gives us the gradient in every point of the function, our question is now what will be the result of integrating a function. A remark at the begining, it will be the area between function and x-axis. To get an simple starting point let us introduce a real simple view of the area between graph of the function and x-axis. We will build the area by adding equidistant rectangles to the graph so that it will be a first approximation of our searched area. But for a graph we first need a function, let it be f(x)=x58.6x4+25.1x328.3x2+10.4625x0.7875f(x)=x^{5}-8.6x^{4}+25.1x^{3}-28.3x^{2}+10.4625x-0.7875. The first question now is how does our function look like. First we will define our variables and our two needed functions.

var("x" "n"); f(x)=x^(5)-8.6*x^(4)+25.1*x^(3)-28.3*x^(2)+10.4625*x-0.7875; def stair(n): return plot((x-0.1)*(x-0.5)*(x-1.5)*(x-3)*(x-3.5),(x,-0.1,4))+plot_step_function([(i,f(i)) for i in srange(0,4,n)],rgbcolor=(1,0,0))
plot(f(x),(x,-0.1,3.6))

Starting with the above mentioned naiv way of "finding" the area between graph and x-axis, we will build a simple function, called "Stair-function". For this Stair-function we need to split our interval, let's call it [a,b][a,b] in equidistant intervals. If we like to have n equidistant intervals, every length of an interval will be ban\frac{b-a}{n} LU (length-units). With this approach we are receive great errors for the area in the beginning, but as more intervalls we use, as smaler is getting our error.

First let us remember the area of an rectangle. It was defined as aba\cdot b, so we will get for each of our above defined rectangles an Area Arect=banf(i(ba)n)A_{rect}=\frac{b-a}{n}\cdot f\left(\frac{i\cdot(b-a)}{n}\right) AU (area-units) with i=0,,n1i=0,\ldots,n-1.

The following graphic will show you our made aproach with intervall-lengths from 1 LU down to 0.05 LU in steps of 0.05, just use the slide to make the intervall-length greater or smaller.

@interact def _(t1=text_control("Intervallength:"), l = slider(.05,1,.05,1)): show(stair(l))
Intervallength:
[removed]
[removed]
[removed]
[removed]

As one can see in the graph above, our red "stair-function" is aproximating our function even better, if we use small intervall-lengths or with other words many intervalls.

If we calculate now the area between graph and x-axis we would find the following function: AGraph=i=0n1banf(i(ba)n)A_{Graph}=\sum\limits_{i=0}^{n-1}\frac{b-a}{n}\cdot f\left(\frac{i\cdot(b-a)}{n}\right). Now let us create as many intervalls as possible, what would result in infinitesimal small intervall-lengths in the x-coordination. So we would do the following: limni=0n1banf(i(ba)n)=abf(x)dx=[F(x)]ab=F(b)F(a)\lim\limits_{n\to\infty}\sum\limits_{i=0}^{n-1}\frac{b-a}{n}\cdot f\left(\frac{i\cdot(b-a)}{n}\right)=\int\limits_{a}^{b}f(x)dx=\left[F(x)\right]_{a}^{b}=F(b)-F(a).

Let us first collect some the important functions and their intergrals:

Important Integrals
f(x)f(x) F(x)F(x) f(x)f(x) F(x)F(x)
00 cc xnx^{n} 1n+1xn+1+c\frac{1}{n+1}x^{n+1}+c
aa ax+cax+c anxn+an1xn1++a1x+a0a_{n}x^{n}+a_{n-1}x^{n-1}+\ldots+a_{1}x+a_{0} ann+1xn+1+an1nxn++a12x2+a0x+c\frac{a_{n}}{n+1}x^{n+1}+\frac{a_{n-1}}{n}x^{n}+\ldots+\frac{a_{1}}{2}x^{2}+a_{0}x+c
sin(x)\sin(x) cos(x)+c-\cos(x)+c cos(x)\cos(x) sin(x)+c\sin(x)+c
sin(x)-\sin(x) cos(x)+c\cos(x)+c cos(x)-\cos(x) sin(x)+c-\sin(x)+c
exp(x)\exp(x) exp(x)+c\exp(x)+c 1x\frac{1}{x} ln(x)\ln(x)
ln(x)\ln(x) xln(x)x+cx\ln(x)-x+c
1xn\frac{1}{x^{n}} 1(n1)xn1+c-\frac{1}{(n-1)\cdot x^{n-1}}+c

Let us for an easy approach take a look at h(x):=x5h(x):=x-5, what we wanna like to get is the area in the interval [0,10][0,10]. Therefor we calculate directly:

010h(x)dx=010(x5)dx=[12x25x+c]010=12102510+c1202+50c=0\int\limits_{0}^{10}h(x)dx=\int\limits_{0}^{10}(x-5)dx=\left[\frac{1}{2}x^{2}-5x+c\right]_{0}^{10}=\frac{1}{2}10^{2}-5\cdot 10+c-\frac{1}{2}0^{2}+5\cdot 0-c=0.

But what happened here? As we see in the following graph, there is at least one area that the function has in common with the x-axis, exactly in our interval we receive two areas!

h(x)=x-5; plot(h(x),(x,-1,11))

As a first result we should notice, that our integral delivers oriented areas, and with that in mind our above found result isn't so worse, as both areas we see are from exactly the same size and nullify themself. As we wanna have the area that the graph and the x-axis have together, we need to devide the integral into two single ones. Our dividing points would be the roots of the function. As h(x)h(x) has in x=5x=5 a root, and it is the only root of the function, we see more that the function is vor values x<5x<5 negative and for values x5x\geq 5 positiv. As it is in most cases not so easy to see where a function is positiv and where negative, we can use a nice and simple trick by using the absolute value. So we get:

Ah(x),x=0=05h(x)dx+510h(x)dxA_{h(x),x=0}=\left\vert\int\limits_{0}^{5}h(x)dx\right\vert+\left\vert\int\limits_{5}^{10}h(x)dx\right\vert

and that will deliver us

Ah(x),x=0=[12x25x]05+[12x25x]510=1252551202+50+121025101252+55=252+252=252+252=25A_{h(x),x=0}=\left\vert\left[\frac{1}{2}x^{2}-5x\right]_{0}^{5}\right\vert+\left\vert\left[\frac{1}{2}x^{2}-5x\right]_{5}^{10}\right\vert=\left\vert\frac{1}{2}5^{2}-5\cdot 5-\frac{1}{2}0^{2}+5\cdot 0\right\vert+\left\vert\frac{1}{2}10^{2}-5\cdot 10-\frac{1}{2}\cdot 5^{2}+5\cdot 5\right\vert=\left\vert-\frac{25}{2}\right\vert+\left\vert\frac{25}{2}\right\vert=\frac{25}{2}+\frac{25}{2}=25

Now let the PC proof our calculations.

integral(x-5,(x,0,10))
\newcommand{\Bold}[1]{\mathbf{#1}}0
abs(integral(x-5,(x,0,5)))+abs(integral(x-5,(x,5,10)))
\newcommand{\Bold}[1]{\mathbf{#1}}25

As seen above, integrals represent oriented areas, and that can result in the worsest case in nullifying the areas or a lower area as we search. As a result we need to take care of what we are looking for, an integral or an area. If we are looking for an integral, we don't need to care for anything, but if we search for the area, we need to integrate the function between their roots, and build the absolute value of negative oriented areas.

In the follwoing we are looking for an area covered by two functions. Let us take f(x)f(x) from our example above and i(x)=2xi(x)=2x. First show the graphs so we know of what we are talking.

i(x)=2*x-5; plot(f(x),(x,-.5,4))+plot(i(x),(x,-.5,4),rgbcolor=(1,0,0))

The above picture shows us what areas we want to calculate. As our functions have 3 points together we first need to find them and integrate from the first to the second, from the second to the third intersection and so on. Finding the intersections of ff and ii is simple done by solving the following equation:

f(x)=i(x)f(x)=i(x).

find_root(f(x)-i(x),-2,0)
\newcommand{\Bold}[1]{\mathbf{#1}}-0.246438779676
find_root(f(x)-i(x),0,3)
\newcommand{\Bold}[1]{\mathbf{#1}}2.86955981216
find_root(f(x)-i(x),3,4)
\newcommand{\Bold}[1]{\mathbf{#1}}3.64775146638

By approximation we found the intersections and they will be our interval-boarders. If we now calculate with these boarders we will receive the following area:

abs(integral(f(x)-i(x),(x,find_root(f(x)-i(x),-2,0),find_root(f(x)-i(x),0,3))))+abs(integral(f(x)-i(x),(x,find_root(f(x)-i(x),0,3),find_root(f(x)-i(x),3,4))))
\newcommand{\Bold}[1]{\mathbf{#1}}9.81634090586

The result delivers us that our two functions cover together an area of 9.82 AU.