5.9 Integral

5.9.1 Definition of Anti-derivative via its Differential Equation

The first derivative , the differential quotient, describes the change of a give function y = f(x) in its dependence from the variable x. We can now ask the converse question:

Integral Is there a function F(x) whose change is described by f(x) and what properties does this function have? If such a function exists , it is called the anti-derivative of f(x) or its indefinite integral. It is described by a very simple differential equation:

F(x) = f(x),f given, F wanted  F(x) = Integralof f(x) =f(x)dx d dxf(x)dx = f(x)

The integral sign serves as a reminder, that the calculation proceeds via a summation and the notation f(x)dx reminds us, that a limiting process takes place for the calculation for which the variable interval becomes infinitesimally small, that means Δx dx; we will visualize this soon.

This differential equations defines obviously a whole cohort of functions, that can differ by a constant value, because the derivative (change) of a constant vanishes. Thus the indefinite integral of a given function is known up to a constant.

d dx(F(x) + C) = d dxF(x) = f(x)

If the differential equation has a meaningful solution, i.e. if the function is integrable, the indefinite integral is in analogy to the differential quotient a function, that describes, up to a constant a local property of the integrated function f(x).

5.9.2 Definite Integral and Initial Value

What is the meaning of the integration constant? As long as we do not decide on the range of the variable x it is simply an arbitrary number.

If we however start at a certain initial value x1 and take into account, that f(x) is the change F(x) of the anti-derivative, then the anti-derivative describes the process of the changes in F(x) given by f(x) from the variable value x1 onwards.

We now show this in a simple example from physics: we assume that f(t) is the time dependent velocity of v(t) of an object. The result of this time dependent velocity, which can also have negative values, is the distance traveled F(t) i.e. x(t). Thus v(t) determines the distance from the initial point as a function of time.

The constant C is the initial value F(x1) of the integral for the variable x1, in out example the position from which we start.

Provided the range of the variable is open , i.e. x > x1, the definite integral defined in this way is a function of the variable x.

If we are interested in the behaviour of the anti-derivative in a closed interval x1 x x2 the definite integral becomes a fixed value. The value at the end of the integration range is the result of the initial value and of all changes until the final value of x and is given by the anti-derivative F(x2). The change within the interval results from the difference to the initial value. Calculating this difference also gets rid of the unknown integration constant, if we repeat the same line of thought with for initial and final value with an arbitrary initial value outside of the interval:

x1x2 f(x)dx = F(x2) + C - (F(x1) + C) = F(x2) - F(x1)

This relationship is known as main theorem of differential and integral calculus.

Thus, in order to calculate a definite integral we “only” need to know its anti-derivative. To determine the anti-derivative for an arbitrary function f(x) is in general not as easily possible as for the derivative. Basic functions can be easily integrated via inverting the well known relations for their derivatives; for many complicated functions there are tables. There are also quite a few useful, general rules, that can help to find the anti-derivative, for example “integration by parts”. But there is unfortunately no rule that always succeeds.

Therefore numerical methods play an especially important role for integration, as we will discuss later.

5.9.3 Integral as Limit of a Sum

In analogy to calculating the partial sums of a series one can define the integral as surface measure of the function value in an interval of the variable. It is obvious, that one can not simply calculate a sum of function values, since their number would be infinitely large. The factor to be used is analogous to the index difference for series and is equal to the width of the interval. If one multiplies this factor with a suitably chosen function value we obtain a measure for the surface under the function in the interval.

Since functions change in general when the variable changes, choosing an arbitrary function value from the interval (for example at the the beginning , in the middle or at the end) can only yield an approximation. In this case one decomposes a larger interval [x1x2] into n intervals chosen equal for expedience of width Δx = (x2 - x1)n and sums over the approximate measures of the sub-intervals. Then the integral is defined as limit of this sum for a vanishingly small sub-interval.

The notation in the following three lines is somewhat inexact!!!

Measure of the sub-interval Δx : f(xi)Δx;xiinΔx Total measure of the region x2 > x > x1 : xi=x1x2f(xi)Δx Integral: x1x2f(x)dx = limΔx0x i=x1x2f(x i)Δx

The definite integral provides the area between the function f(x) and the x-axis in the region of integration.

The limiting process is shown in the interactive simulation of Fig.5.10

The sine function to be integrated is drawn in blue, while the analytical integral function is drawn in red. The small blue point, that can be moved with the slider indicates the initial point for the integration and thus at the same time the zero point of the formal integral. The thick end point in magenta can be adjusted with the mouse. The second slide determines the number of sub-intervals .

The green rectangles represent the contribution for the individual interval, if the initial value of the function in the interval is assumed to be constant for the whole interval. The sum of the contributions for all intervals yields the big green point. With decreasing width of the intervals it approaches the analytically calculated integral. For a sufficiently large number of intervals this value runs along the integral curve when pulling the end point.

You will find further instructions for experiments in the description pages of the simulation.


PIC
Figure 5.10: Limiting processes for the integration using the step function approximation (green), shown for the example of the sine function (blue). For each interval the initial value is assumed to be valid. The red curve is the anti derivative, the point filled in green indicates the approximation for the definite integral in the integration region whose initial and final point can be adjusted. The number of intervals n (n = 10 in the figure) can be adjusted with the slider.

5.9.4 The Definition of the Integral due to Riemann

We still require a criterion to decide, whether a function can be integrated at all in a given region. In the classical sense this is provided by the Integral definition of Riemann.

RiemannInt For this purpose we define for the intervals given by x0 < ... < xi < ... < xn with interval widths xi - xi-1 = Δxi two sums, namely the upper sum and the lower sum, of which the first one uses the largest function value, the supremum, in each interval and the second one uses the smallest function value, the infinum, in each interval. If both sums converge to the same value for n , the one from above the other one from below, the function is considered as integrable in the Riemannian sense

an inexact notation again!!!

First measure for sub-interval Δix :  Δix supremum of f(x) in (Δix) Second measure for sub-interval Δix :  Δix infimumof f(x) in (Δix) First sum measure for region x2 > x > x1 : i=1nΔix supremum of f(x) in (Δix) Second sum measure for region x2 > x > x1 : i=1nΔix infimum of f(x) in (Δix) Riemann- integral x1x2f(x)dx exists, if  limn i=1nΔix supremum of f(x) in (Δix)=! limn i=1nΔix infimum of f(x) in (Δix)

In the following interactive simulation shown in Fig.5.11 the construction of the Riemannian sums is demonstrated using the example of the sine function. In the left window the upper sum (supremum) is used and in the right window the lower sum (infinum). The width of all intervals is the same. The formal integral is shown in yellow. The initial and final x-values can again be adjusted as well as the number of intervals. With increasing resolution both sums tend to the same value.

The initial x-value can again be adjusted with a slider and the final x-value ( magenta coloured) can be pulled with the mouse. The number n of sub-intervals in the integration region is adjusted with the second slider. The analytically determined integral is indicated in yellow. Its initial value is given by the initial ordinate of the integration region. The point that is surrounded by a square shows the sum of approximating intervals.


PIC
Figure 5.11: Limiting process for the Riemann integral for the example of the sine function (black); anti-derivative yellow. Integration region and number of intervals can be adjusted, 10 intervals in the figure. For the upper sum the highest value is used and for the lower sum the smallest value is used in each interval. The rectangular markers indicate the approximations for supremum (left window) and infimum (right windows).

If it is known, that a function is Riemann-integrable, then any sum that uses as measure any value of the function in the sub-intervals converges against the integral. Thus one has a lot of freedom in the choice of numerical integration method. You are urged to compare the last two figures. The step-function approximation is neither equal to the approximation with the supremum nor to that via the infinum. but converges to the same limit.

As an example for a function, that can not be integrated in the Riemannian sense, the exotic function mentioned above can be considered:

f(x) = 1forxirrational, 0for xrational Domain of definition: 0 x 1

In its domain of definition it has obviously an upper sum 1 and a lower sum 0, since there are both rational and irrational numbers in every interval of an arbitrarily small length Δx > 0, and thus there exist function values of 0 and 1. Thus the upper sum and the lower sum converge, but not to the same value and therefore the function is not Riemann-integrable.

5.9.5 Lebesgue Integral

LebesgueInt

The previous statement is not really satisfactory. The number of rational numbers is much smaller than that of the irrational ones, and therefore the function f(x) has the value !1 for nearly all values of x. Therefore the integral of this function should be close to 1.

This question can be more easily answered with the alternative notion of the Lebesgue-integral. For this approach one subdivides the integration region in stripes parallel to the x-axis and asks for the limit of the sum over these intervals, each interval contributing the product of the function value in the interval and the corresponding Lebesgue-measure of the interval on the ordinate:

μ(Δy) =  Measure of all x- values , whose f(x) lie in Δy.

In the exotic example the top stripe has the function value 1 and the measure of its variable interval is (for the moment approximately) 1, since nearly all numbers are irrational. the lowest strip has the function value 0, independent of the measure for the variable interval.

The exotic function is therefore Lebesgue-integrable and the result is 1.

The advantage of the integral definition of Lebesgue is, that using it , the integral notion can beyond the domain of numbers to sets in general, if these set can be decomposed in to subsets, which each can be measured in the sense of a finite area. The following holds: a function, that is Riemann-integrable is also Lebesgue-integrable but the converse is not true. Thus the Lebesgue integral is the more general notion.

For the following simple example we visualize the integration of a parabola on the left hand side using Riemann’s approach and on the right hand side with Lebesgue’s approach. For the Lebesgue integral the interval measure was calculated in such a way, that the measure is exact irrespective of the width of the interval. the


PIC
Figure 5.12: Interval subdivision for Riemann and Lebesgue integral; the function is shown in blue, the anti-derivative in yellow and the red points indicate the approximation for the chosen number of points n. The integration region can be adjusted. For the Lebesgue integral the correct measure for the limit was already used.

5.9.6 Rules for the Analytical Integration

As for derivatives there a number of important and general rules (the integration constant we drop in the following for clarity).

Cdt = Cdt = Ctconstant C withg = g(t)undh = h(t) (g(t) + h(t))dt =g(t)dt +h(t)dtAdditivity gdh = gh -hdgIntegration by parts  f(t)dt =f(g(x))g(x)dx Introduction of a new variable x via t = g(x)

For the especially useful rules of partial integration and substitution of a new variable it is important, to find such functions that can be easily integrated, as for example the exponential function, powers of x and the trigonometric functions.

The following formulas for basic functions without the integration constant follow very easily from the formulas given above for the first derivatives and therefore we only list those of the largest practical importance

Cdt = Ct tndt = tn+1 n+1 etdt = et atdt =et ln a = at ln a 1 t dt = lnt sintdt = -cost costdt = sint

The analytical integration of functions that can be integrated in principle and are possible rather complex is as a rule more tedious than the always easily achievable differentiation. Therefore there exist voluminous collections of integrals in the corresponding text books, manuals and on the internet. Numerical computer program such as Mathematica also have a wide range of formal integrals built in, that one can access as formulas if one enters the function to be integrated.

It is obvious that numerical integration methods play a very important role, since it does not matter for their application whether an integral of the function to be integrated is known analytically or not, and since one can even integrate functions, that are only known as discrete measured values fi.

5.9.7 Numerical Integration Methods

Integrals often have to be calculated numerically , if it is not possible to determine the anti-derivative analytically. In this case the sums obtained using step functions converge only relatively slowly when decreasing the interval widths; one would have to therefore subdivide the integration region into many sub-intervals to achieve a high accuracy.

Therefore one uses other approximations of the function f(x) than the step functions in order to reach convergence faster. An obvious approximation when looking at the last figure consists of not taking the value f(xi) at the beginning of the interval as constant for the interval (step-function approximation), but to use the mean value between initial and final value 1 2 f(xi) + f(xi + 1). This corresponds to a trapezoidal approximation , where one adds to the staircase the triangle leading to the next function value; the curve is now approximated via the initial value in the interval and the secant connecting the final and initial value with the slope yi+1-yi Δx .

The approximation of the function becomes even more accurate if one uses a parabola

S Rule (Simpson’s/Kepler’s method), that is fixed via three consecutive function values. This now also takes the curvature (second derivative) in each interval into account approximately. Thus those regions of the function that possess like a parabola no turning points in the respective sub-intervals (xi,xi+1) are approximated well. One can continue is this manner if one uses polynomials of third or fourth degree which then also allow for the representation of turning points. However one then needs to use more and more intermediate points in each sub-interval. Therefore one usually restricts this approach to the parabola and chooses the interval sufficiently small.

All these methods have the advantage, that the approximation of the function in terms of constants, secants and parabolas can be quite easily integrated.

Rectangle approximation:y = yi xixi+Δixydx x1x1+Δixy1dx = Δix yi Trapezoidal approximation:y = yi + yi+1-yi Δix (x - xi) xixi+Δixydx Δixyi + yi+1-yi Δix (xi+Δix)2-x i2 2 - xi(xi + Δix - xi) = Δixyi + Δix 2 (yi+1 - yi) = Δix 2 (yi + yi+1) Parabolic approximation:xixi+Δixydx xixi+2Δix(ax2 + bx + c)dx = Δix 3 (yi + 4yi+1 + yi+2)


PIC
Figure 5.13: Step-function , trapezoidal and parabolic approximation for the numerical integration of the sine function (blue) with two sub-intervals. When reducing the size of the intervals one can compare the convergence of these approximations. The closer the numerical value (green) point is to the known analytical curve , the better the approximation methods performs.

The simulation in Fig.5.13 compares the three methods for two adjacent sub-intervals. As example we again consider the sine function(blue) with its analytical integral (red). Initial and end point of the integration region can be changed. The sum of both sub-intervals is shown as a green point. The Simulation shows the large superiority of the parabolic approximation, whose result agrees with the red curve even for a coarse subdivision of the interval.

It is a bit tedious to calculate the parameters of a parabola, that goes through three points, but this is only necessary, if as for this simulation the osculating curves are calculated. The following steps are required for the calculation in each sub-interval xi = x11 2(xi + xi+1) = x2,xi+1 = x3:

coordinates in the interval x1,y1x2,y2x3,y3withx2 -x1 = Δix2;x3 -x2 = Δix2;Δix = x3 - x1 general parabola y = ax2 + bx + c  the parameters a, b, c are determined from the function values: 1 y1 = ax12 + bx1 + c,2 y2 = ax22 + bx2 + c,3 y3 = ax32 + bx3 + c. Solution for a,b,cyields a = 2 Δx2 (y1 - 2y2 + y3) b = 2 Δx(y2 - y1) - (x1 + x2)a = 2 Δx(y2 - y1) - 2 Δx2 (x1 + x2)(y1 - 2y2 + y3) c = y1 - ax12 - bx1 = y1 - x12 2 Δx2 (y1 - 2y2 + y3) - x1 2 Δx(y2 - y1) - (x1 + x2) 2 Δx2 (y1 - 2y2 + y3)

For the approximation to the integral over the sub-interval Δig one obtains, using the parameters of the parabola and integrating a surprisingly simple formula, for which only the three function values and the width of the interval are required.

parabolic approximation of xixi+1 f(x)dx  xixi+1 (ax2+bx+c)dx = Δxi 6 (yi+4yi+1 2 +yi+1)

5.9.8 Error Estimate for Numerical Integration

To get an idea of the accuracy of the different integration methods, we expand the function in a Taylor series and use, assuming the interval is sufficiently small, the first neglected term as an estimate for the error. To simplify the notation, we expand the function in a Taylor series around x = 0 up to 5th order:

 f(x) = y(x) = y(0) + y(0)x + y(0)x2 2! + y(0)x3 3! + y(4)(0)x4 4! + y(5)(0)x5 5! 1)0Δxf(x)dx =y(0)Δx + y(0) 2 Δx2 + y(0) 32! Δx3 + y(0) 43! Δx4 + y(4)(0) 54! Δx5 + y(5)(0) 65! Δx6 2)-Δx0f(x)dx =y(0)Δx -y(0) 2 Δx2 + y(0) 32! Δx3 -y(0) 43! Δx4 + y(4)(0) 54! Δx5 -y(5)(0) 65! Δx6

 -ΔxΔxf(x)dx =0Δxf(x)dx +-Δx0f(x)dx =2 y(0)Δx + y(0) 3! Δx3 + y(4)(0) 5! Δx5 -Δx2Δx2f(x)dx =2 y(0)Δx 2 + y(0) 3! Δx 2 3 + y(4)(0) 5! Δx 2 5

For the step-function method we use only the first term y(0) in 1). The error for each interval is thus of the order Δx2. If one wants know the error for the whole integration region, one has to sum over LΔx interval. Thus the total error is proportional to Δx. Doubling the resolution leads to halving of the error or doubling of the accuracy.

For the trapezoidal method the first two terms are used in 1). The error then is proportional to Δx3, thus the total error depends on Δx2. Doubling the resolution leads to a improvement in the accuracy by a factor of 4.

For the parabola method we expand the function from the middle of the double interval once to the right and once to the left and the integral over the whole interval is the sum over both sub-interval. The result then only contains odd powers of Δx. For the parabola we also take into account the curvature, i.e. y. The error for each interval is then proportional to Δx5, the total error is thus proportional to Δx4; doubling the resolution leads to an increase of the accuracy by a factor of 16. In addition the large factor 5! = 120 contributes to a small error.

Important hint: the approximating parabola used for the integration is not identical with the third partial sum of the Taylor series. This one only agrees with the function at the computation point, while the approximating parabola used for the integration is equal to the function at all three points.

The following figure compares the deviation from the analytic integral for the sine function in double logarithmic scale for the trapezoidal and parabolic methods as function of the resolution (number) of sub-intervals. The points represent the numerical integration results over a constant integration region, the lines represent the functions an-2 and bn-4, with a and b chosen in such a way, that both lines coincide with the numerical error for the smallest number of intervals. The further behaviour of both functions and the points confirms the expected dependence on n.

This example should show demonstrate to you, how versatile the Taylor series of fifth order is, and therefore we have treated this in such depth.


PIC
Figure 5.14: Comparison of accuracy achieved for the numerical integration using to the trapezoidal and parabolic approximations as function of the number of sub-intervals n. For 100 sub-intervals the parabolic approximation is at least 5 orders of magnitude more accurate.