Docsity

Antiderivative and Integration Techniques, Study notes of Computer Science

Toggle sidebar
bg1
Chapter 17 Integration
Section 17.1 Recalling basic facts about integration
We review some of the basic facts and terminology about integration from your calculus course.
Definite integration can be related to finding the area under a curve described by a function.
The definite integral
a
b
f x dx
is notation for this. If an answer for a definite integration problem exists, then it is a number
which could be described exactly or approximated as with a calculator.
Indefinite integration is the problem of antidifferentiation. That is, given a function f, we must
find another function F such that
d
dx F x =f x .
We can write the previous relationship as the indefinite integral
f x dx = F x .
Sometimes the antiderivative F(x) is written with an extra symbolic constant, as in
f x dx = F x CC, particularly if antidifferentiation is going to be applied as only one step of
a problem-solving process. Since the hard part of doing indefinite integration is finding F(x)
without the constant and since the name of the constant can be freely chosen, symbolic
computation systems often omit the constant in their answers, letting the user add in the constant
of their choice later if they need to.
The answer F(x) is expected to be a formula involving expressions and functions that the user
already knows about. F(x), when it exists, is referred to as a closed form solution to the
integration problem. For calculus freshmen, these are expressions that involve numbers,
polynomials, roots, rational functions, trig, logarithm and exponential functions. For more
advanced mathematics students, it might include other functions: erf (error function), Ei
(exponential integral), Bessel, Γ, etc.
The Fundamental Theorem of Calculus (FTC) states that we can evaluate a definite integral in
terms of an antiderivative via the formula
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25

Partial preview of the text

Download Antiderivative and Integration Techniques and more Study notes Computer Science in PDF only on Docsity!

Chapter 17 Integration

Section 17.1 Recalling basic facts about integration

We review some of the basic facts and terminology about integration from your calculus course.

Definite integration can be related to finding the area under a curve described by a function.

The definite integral a

b f x d x

is notation for this. If an answer for a definite integration problem exists, then it is a number which could be described exactly or approximated as with a calculator.

Indefinite integration is the problem of antidifferentiation. That is, given a function f , we must find another function F such that

d d x

F x = f x.

We can write the previous relationship as the indefinite integral

f x d x = F x.

Sometimes the antiderivative F(x) is written with an extra symbolic constant, as in f x d x = F x C C , particularly if antidifferentiation is going to be applied as only one step of

a problem-solving process. Since the hard part of doing indefinite integration is finding F(x) without the constant and since the name of the constant can be freely chosen, symbolic computation systems often omit the constant in their answers, letting the user add in the constant of their choice later if they need to.

The answer F(x) is expected to be a formula involving expressions and functions that the user already knows about. F(x), when it exists, is referred to as a closed form solution to the integration problem. For calculus freshmen, these are expressions that involve numbers, polynomials, roots, rational functions, trig, logarithm and exponential functions. For more advanced mathematics students, it might include other functions: erf (error function), Ei (exponential integral), Bessel, Γ, etc.

The Fundamental Theorem of Calculus (FTC) states that we can evaluate a definite integral in terms of an antiderivative via the formula

a

b f x d x = F b K F a ,

where F is any function such that

d d x

F x = f x.

Programs for doing indefinite integration have been around from the early '60s. They can be found in a number of symbolic systems: Maple, Mathematica, Macsyma (now found in SAGE), and MuPad (now found in the Symbolic Toolkit of Matlab).

Section 17.2 Indefinite integration

Section 17.2.1 Doing anti-differentiation with int

Figure 17.2.1.1 Indefinite integration with int

The clickable interface can be used to input an indefinite integration problem for Maple to compute. Use the f d x item in the Expression Palette, then edit the expression f and the

variable of integration x.

The general form of the textual version of the integration command is

int( expression , var )

This computes the anti-derivative of the expression, with respect to the variable var.

Example 17.2.1.1 Indefinite integration with int

Example Commentary

1 x

d x

ln x

cos x^2 d x

1 2

cos x sin x C

x

cos^2 x d x

The clickable interface can be used to enter the integration problem.

Note that in the clickable interface there are two ways of entering what is " cos x $cos x ".

Use int to calculate the answer Apply diff to the answer, to see (by visual inspection) if you end up with the integrand (the original function you were trying to integrate). If the derivative does not look the same as the integrand, , try simplify on the difference between the result of step (2) and the original expression. If you get zero, the two are equivalent.

Example 17.2.2.1 Checking answers

Example Commentary

expr d 1 C x C

cos x 2

1 C x C

cos x

answer d int expr , x

x C

x^2 C

sin x

dAnswer d diff answer , x

1 C x C

cos x

expr K dAnswer 0

The derivative of the symbolic integral is the same as the original expression. This is obvious just by "eyeballing" it, but we can also confirm that the difference between expr and the derivative is 0.

expr d sin x^2 sin x^2 answer d int expr , x

K

cos x sin x C

x

dAnswer d diff answer , x 1 2

sin x^2 K

cos x^2 C

d d expr K dAnswer 1 2

sin x^2 C

cos x^2 K

simplify d 0

The derivative of the symbolic integral does not appear at first glance to be the same as the original expression.

However, the difference between them does simplify to zero, so they are equivalent. Maple does not automatically employ trig identities such as sin^2 a Ccos^2 a = 1 because it would often introduce tedious delay to try to apply all possible identities all the time.

expr d x ^2 C 1 / x K 1 Here is another example of a symbolic integration answer whose derivative does not appear to be the same as the starting

x^2 C 1 x K 1 answer d int expr , x 1 2

x^2 C x C2 ln x K 1

dAnswer d diff answer , x

x C 1 C

x K 1 simplify expr K dAnswer 0

expression. However, simplification of the difference between the two indicates that the two are equivalent because their difference simplifies to zero.

Sometimes the "simplify the difference to zero" trick is not needed to check work because it is obvious that the two are the same. Maple has other simplification functions that will attempt to put results into alternative forms.

Example 17.2.2.2 Using normal with the expanded option to manipulate answers

Example Commentary

answer d

x^2 C x K 2 3 x^3 K x^2 C 3 x K 1

d x

ln x^2 C 1 C

arctan x

K

ln 3 x K 1

dAnswer d diff answer , x 4 5

x x^2 C 1

C

5 x^2 C 1

K

5 3 x K 1

normal dAnswer x^2 C x K 2 x^2 C 1 3 x K 1 normal dAnswer , expanded x^2 C x K 2 3 x^3 K x^2 C 3 x K 1 simplify dAnswer x^2 C x K 2 x^2 C 1 3 x K 1

normal does a specific kind of simplification -- it tries to combine expressions that have symbolic numerators and denominators into a standard form.

By default, normal(expr) tries to keep numerators and denominators of expr that are factored as products of expressions rather than expanding everything out n ormal( expr, expanded ) will try to expand them. In this situation, normal(...,expanded) is the way to show that dAnswer is mathematically equivalent to the integrand

simplify does only what ordinary normal does, so we couldn't use it to show the equivalence of dAnswer and answer.

work with it, and b) understand when the computer system is telling them that it can't find a closed form solution.

Example 17.2.3.1 Integration answers using advanced functions

e x

2 d x

K

I π erf I x

You wouldn't see this integration problem in an elementary calculus textbook, because the answer involves the "error function". The term "error function" is not indication that there is a mistake, but refers to the function's use in probability and statistics. You can read more about the error function by typing "erf" or "error function" into Maple's on-line help.

int

log t^2

, t

K

t ln t

KEi 1, Kln t

The "Ei" function is referred to as the "exponential integral function".

x^6 CC x^3 C 1 x K 1 $ x^5 C 2 $ x C 1

d x

x C

_R = RootOf 11317 _Z^5 K 11317 _Z^4 C 9600 _Z^3 K 9504 _Z^2 K 17984 _Z C 32512

_R ln x

C
_R^4
C
_R^3
C
_R^2
K
_R
K
C

ln x K 1

This a situation where there is a closed form solution, but it involves the roots of a polynomial that cannot be expressed in terms of conventional square roots, cube roots, n th roots, etc.

The answer includes a sum over all the zeroes _R (complex or real) of the polynomial equation 1317 _Z^5 K 11317 _Z^4 C 9600 _Z^3 K 9504 _Z^2 K 17984 _Z C 32512 .

fsolve( 1317 _Z^5 K 11317 _Z^4 C 9600 _Z^3 K 9504 _Z^2 K 17984 _Z C 32512 ,_Z,complex) says that these roots have the approximate values K1.060190349,K0. K1.388526569 I , _Z = K0.06877225771 C1.388526569 I, 1.098867432 K0.4410400875 I, 1.098867432 C0.4410400875 I This is one of those situations where it will be difficult to get much use out of the symbolic answer. If you are really doing a definite integration problem involving this integrand, pursuing an approximation to the

definite integral as discussed in Section 17.2, may be a better ploy.

Example 17.1.3.2 Integration answers when Maple can't find an expression for the anti-derivative

answer d int f x , x f x d x (1.2.3.4)

answer2 := int(g(t),t); printf("The answer was: %a",answer 2 );

g t d t

the answer was: int(g(t),t)

Maple can't find the anti-derivative because we haven't told it what the function f is.

It can't find the symbolic integral for g either, for the same reason. We see that printf says that the value of answer2 is, in textual form, the same as the input was. Expression 1.2.3.4 would print out the same way if we used print rather than Maple's default 2d math output to display that result.

int 1 / sqrt log sin x C 1 Cexp x , x 1

ln sin x C 1 Ce x^

d x (1.2.3.5)

Here's another example of an integral that Maple can't do even though the expression being integrated is something that it recognizes.

Section 17.2.4 int doesn't work on functions, only expressions

int only works with expressions, not names of functions. You wouldn't expect to input sin d x

and expect to get an answer, since just "sin" doesn't mention any variable to integrate with

respect to. You would expect only sin x d x to work. In a similar fashion symbols that are

assigned expressions as values, rather than function definitions, can be used successfully with int.

Example 17.2.4.1 Variables assigned expressions work with int , but not variables assigned function definitions.

cos d t

cos t

Symbolic integration seems to suggest that the integral of cosine with respect to t is cos (t). But Maple would display that as "cos(t) ", not "cos t". The answer is a look-alike which can be confusing.

return K x end if ; end proc x if 0 != x then return x else return K x end if end proc int procAbs b , b Error, (in procAbs) cannot determine if this expression is true or false: 0 <= b

proc&ew d proc x eval exp x $ a , a = 2$ x end proc x eval exp x * a , a = 2 * x end proc int proc&ew y C 1 , y 2 e y^ C^1 y

But it doesn't work. This is because the if statement gives an error when it tries to decide whether x is greater than zero when there is no numerical value for x.

We are not saying that you can't use a function defined through a Maple procedure in symbolic integration. If the procedure can execute and return a symbolic expression even if its arguments are symbols, then there is no problem.

This computes the integral of exp(y+1)* (y+1). Note that we could use it to calculate the integral of exp(z)2z, exp(w)2w, etc. in a similar fashion.

Section 17.2 Definite integration

Figure 17.2.1 Definite integration with int

The clickable interface can be used to input a definite integration problem for Maple to

compute. Use the a

b f d x item in the Expression Palette, then edit the expressions f, a, and b ,

and the variable of integration x to suit your problem.

The general form of the textual version of the command is

int( expression , var = a..b )

If the answer to a definite integration problem returns as the symbolic answer, then doing evalf( ...) of it will produce an approximation to the area, using techniques that do not require symbolic integration to find the answer. Approximation techniques will also be used if integrand or the limits of integration involve floating point numbers rather than exact fractions.

Example 17.2.1 Definition Integration examples

Example Commentary

Anton, Calculus 8th e d. problem 6..5.14.

Calculate

K 10

5 6 d t ,

Kπ 3

π 3 sin x d x , 0

3 x K 2 d x , 0

2 4 K x^2 d x

K 10

5 6 d t

int sin x , x =K

π 3

π 3 0

0

3 x K 2 d x

int(sqrt( 4 - x^ 2 ),x= 0 .. 2 );

π

Using the clickable interface.

Using the document interface but with the textual form of the operation.

Using the clickable interface again.

Entry of the operation within a code edit region.

Anton problem 6.6.25. Calculate

1

4 3 t

K 5 t K t

K^32 d t

int 3 / sqrt t K5 * sqrt t K t ^ K3 / 2 , t = 1 ..

K

Anton problem 32 (a). Calculate

K 3

3 x^2 K 1 K

x^2 C 1

d x. Answer should be 30*

arctan(13/9) + 28/3.

int abs x ^2 K 1 K15 / x ^2 C 1 , x =K3 ..

28 3

K30 arctan 3 C60 arctan 2

simplify (1.3.5)

30 arctan

C

The original form of the answer given by Maple does not match the answer key, but fortunately the simplify function reduces the result to the desired form. This does not always happen for definite integration results. Sometimes further manual operation may be necessary.

Anton problem 32 (b). Calculate

0

3 2 1

1 K x^2

K 2 d x using Theorem 6.5.5,

which states that for a! b! c , a

c

f x d x =

a

b

f x d x C b

c

f x d x.

You will find it necessary to choose a good splitting point -- try plotting the function and finding where it is zero.

expr d abs 1 / sqrt 1K x ^2 Ksqrt 2

1

1 K x^2

K 2

int expr , x = 0 ..sqrt 3 / 2

0

1 2 3 1

1 K x^2

K 2 d x

plot expr , x = 0 ..sqrt 3 / 2

It usually doesn't hurt to see if Maple's software has advanced to the point where it can do the problem all by itself. But we see here that since the result is the same as the input, that Maple can't do the problem without help.

Plotting the function suggests that there's quite a change occurring around 0.7. This point is probably the splitting point that the problem is suggesting we find. But what is it, exactly?

x
K 4 K 2 0 2 4
K 100
K 50
100 exactly cancelled by the negative area

between -5 and 0.

Anton Example 4, ch. 8 Evaluate

KN

N 1 1 C x^2

d x

KN

N 1 1 C x^2

d x

π

Anton Example 6 (c) Ch 8. Evaluate

0

N 1 x $ x C 1

d x

answer := int(1/(sqrt(x)*(x+1)), x = 0 .. infinity); printf("sin evaluated at the answer is: %a", sin(answer));

π

sin evaluated at the answer is: 0

Maple can do improper definite integrals since it can do symbolic limits (e.g. the functionality available through limit ).

You can input infinity by through the "Common Symbols" palette that can be found on the left hand side of the Maple application window.

Infinity is can also be input textually as the symbol infinity.

Example 17.2.2 Approximate definite integration examples

int

exp x^2 log x^2

, x = 2 ..

2

3 e x

2

ln x^2

d x

evalf (1.3.15)

int

exp x^2 log x^2

, x = 2 ..3.

int

exp x^2 log x^2

, x = 1 ..

1

3 e x

2

ln x^2

d x

evalf (1.3.18)

Float N

Maple is unable to calculate the exact solution to this definite integration problem.

evalf says that the area is approximately 694.15.

Note that the difference between this and the original input was that we have changed the upper limit of integration from "3" to "3.0". Because this is a floating point number, Maple will use evalf automatically.

This is the same integrand. Note that the lower limit of integration is where the integrand is infinite.

Not surprisingly, the approximation method doesn't give us a number for the answer. Since the approximation method doesn't guarantee that its answer is close to the actual answer, this result doesn't prove that the area under the curve is infinite. Further analysis by a mathematician might establish this conclusively.

int

x^6 C 2 $ x C 1 x^3 C 2 $ x^2 C 1

, x = 0 ..

K >

_R = _RootOf Z^3 C 2 _Z^2 C 1 2 5 K _R C 10 _R^2 ln K __R R 3 _R C 4

K

C >

_R = _RootOf Z^3 C 2 _Z^2 C 1 1 _R 3 _R C 4

2 5 K _R

C 10 _R^2 ln 1 K _R

There is a symbolic solution to the integral, but it's messy. An explanation of "RootOf" can be found in Example 17.1.3.2.

As with the integrand above, making the upper limit of integration into a floating point number invokes the approximation technique that evalf uses.

Problem 11, section 7.4 Anton p. 489:

Let the parameterization be x = cos 2$ t ,

y =sin 2$ t , 0 % t %

π 2

. Find the arclength.

plot cos 2$ t , sin 2$ t , t = 0 ..

π 2

, scaling

= constrained

K 1 K0.5 0 0.5 1

Student Calculus1 ArcLength cos 2 * t ,

sin 2 * t , t = 0 ..π / 2 π

When plot's first argument is a list containing the description of a parameterization, it will produce a parametric plot. We say scaling = constrained so that the x and y axes are given the same scaling. Parametric plotting is discussed further in section 18.1.

npExpr d sqrt 1 K x^2

1 K x^2

plot npExpr , x =K1 ..1, scaling = constrained

x
K 1 K0.5 0 0.5 1

As the plot indicates, this is the same situation, in non-parametric form.

with Student Calculus

AntiderivativePlot , AntiderivativeTutor , ApproximateInt , ApproximateIntTutor , ArcLength , ArcLengthTutor , Asymptotes , Clear , CriticalPoints , CurveAnalysisTutor , DerivativePlot , DerivativeTutor , DiffTutor , ExtremePoints , FunctionAverage , FunctionAverageTutor , FunctionChart , FunctionPlot , GetMessage , Get&umProblems , GetProblem , Hint , InflectionPoints , IntTutor , Integrand , InversePlot , InverseTutor , LimitTutor , MeanValueTheorem , MeanValueTheoremTutor , &ewtonQuotient , &ewtonsMethod , &ewtonsMethodTutor , PointInterpolation , RiemannSum , RollesTheorem , Roots , Rule , Show , ShowIncomplete , ShowSteps , Summand , SurfaceOfRevolution , SurfaceOfRevolutionTutor , Tangent , TangentSecantTutor , TangentTutor , TaylorApproximation , TaylorApproximationTutor , Understand , Undo , VolumeOfRevolution , VolumeOfRevolutionTutor , WhatProblem

ArcLength npExpr , x =K1 ..

π

ArcLength cos 2 * t , sin 2 * t , t = 0 ..π / 2,

output = plot , showfunction = true , showintegral = true , showintegrand

ArcLength is a function in the Student [Calculus1] package. As with all Maple packages, we can load the package in using with and then just refer to the name of the function directly. Note that the package name itself has brackets in it, unlike other packages such as plots where loading it in would require just with(plots).

This uses the alternative form of ArcLength where the first argument is an expression describing how the vertical coordinate relates to the horizontal one. Since it describes the same situation, we get the same answer.

This alternative form of ArcLength displays not only the parametric curve (in red), but also the cumulative arclength (in green) as t goes from o to π/2.