Integration with computers Indefinite integration Polynomials and rational functions For polynomials, computer algebra systems like Mathematica do a fine job of antidifferentiating. Integrate@x ^ 2, xD x3 3 Note, though, that Mathematica gives only a single antiderivative; it omits the constant of integration. But as soon as we move beyond polynomials to rational functions, there can be problems. Integrate@1 x, xD Log@xD Note that the computer's answer in this case is only a valid antiderivative for positive values of x. (FYI, Mathematica uses Log[x] to mean natural log.) Let's explore this problem further. The (natural) log, absolute value, and Heaviside functions D@Log@xD, xD 1 x (Well, at least Mathematica is consistent...) D@Log@Abs@xDD, xD Abs¢ HxL x¤ This is true, but not very helpful. What about antidifferentiating |x|? 2 Integration.nb What about antidifferentiating |x|? Integrate@Abs@xD, xD à x¤ â x This is Mathematica's way of saying "I don't know how to symbolically antidifferentiate that." In fact, we know that (1/2) x |x| is an antiderivative of |x|; can we get Mathematica to at least recognize this? D@H1 2L x Abs@xD, xD Abs@xD 1 + 2 x Abs¢ @xD 2 Simplify@%D 1 HAbs@xD + x Abs¢ @xDL 2 Guess not! Integration by partial fractions Let's try that integration-by-partial fractions example. Integrate@H3 x ^ 3 - 3 x ^ 2 + x + 1L Hx ^ 4 - 2 x ^ 3 + 2 x ^ 2 - 2 x + 1L, xD 1 + ArcTan@xD + Log@- 1 + xD + LogA1 + x2 E 1-x D@1 H1 - xL + ArcTan@xD + Log@- 1 + xD + Log@1 + x ^ 2D, xD 1 1 + 2 H1 - xL 1 2x + -1 + x + 1+x 2 1 + x2 We need to tell Mathematica to combine terms: Together@%D 1 + x - 3 x2 + 3 x3 H- 1 + xL2 I1 + x2 M Okay, but we had to explicitly prompt Mathematica to write the answer in a friendly form. Integration.nb 3 Polynomials revisited I said before that Mathematica does a fine job of antidifferentiating, but in a sense this isn't true. D@H1 18L Hx ^ 2 + 5L ^ 9, xD 8 x I5 + x2 M Integrate@%, xD 390 625 x2 + 156 250 x4 + 218 750 x6 2 + 21 875 x8 + 4375 x10 + 3 1750 x12 3 + 50 x14 + 5 x16 x18 + 2 18 Simplify@% - H1 18L Hx ^ 2 + 5L ^ 9D 1 953 125 18 Here Mathematica has not chosen a good (i.e., nicely factoring) antiderivative. Human-computer collaboration on an indefinite integral Here's an integral that you can do but Mathematica can't. Integrate@H1 + Log@xDL Sqrt@1 - Hx * Log@xDL ^ 2D, xD à H1 + Log@xDL 1 - x2 Log@xD2 â x Here Mathematica fails to guess the correct substitution. We can help Mathematica out of a jam by giving it the correct substitution: Put u = x ln x, du = (1 + ln x) dx. Integrate@Sqrt@1 - u ^ 2D, uD 1 u 1 - u2 + ArcSin@uD 2 % . u ® x Log@xD 1 ArcSin@x Log@xDD + x Log@xD 2 1 - x2 Log@xD2 4 Integration.nb D@%, xD 1 x Log@xD I- 2 x Log@xD - 2 x Log@xD2 M 1 + Log@xD + 2 + 1 - x2 Log@xD2 2 1 - x2 Log@xD2 + Log@xD 1 - x2 Log@xD2 1 - x2 Log@xD2 Simplify@%D H1 + Log@xDL 1 - x2 Log@xD2 This enhances answer 1 2 KArcSin@x Log@xDD + x Log@xD our confidence in the 1 - x2 Log@xD2 O This is a great example of human and computer working together to achieve a task that would be hard for a human alone or a computer alone. Definite integration The (natural) log, absolute value, and Heaviside functions Definite integrals are often handled by different routines in a computer algebra system than indefinite integrals. For instance, Mathematica does not always evaluate definite integrals by using the Evaluation Theorem. We can see this with an example. Integrate@1 x, 8x, 1, 2<D Log@2D Integrate@1 x, 8x, - 2, - 1<D - Log@2D Mathematica gets the right answer for the definite integral, even though it didn't for the indefinite integral. (What about integrating from -1 to 1? Integration.nb 5 Integrate@1 x, 8x, - 1, 1<D 1 Integrate::idiv : Integral of does not converge on 8-1, 1<. x 11 à -1 âx x Mathematica correctly reports that the integral doesn't converge.) What about integrating the absolute value function? Integrate@Abs@xD, 8x, - 1, 1<D 1 Ditto. Can we use "definite" integration with indefinite limits of integration to get an antiderivative by the back door (i.e. via the FTC)? Integrate@Abs@tD, 8t, 1, x<D - Hx - 1L HReHxL - 1L ImHxL2 + HReHxL - 1L2 - ReHxL , IImHxL2 I2 ReHxL2 - 2 ReHxL + 1M + ImHxL4 + HReHxL - 1L2 ReHxL2 M - ImHxL2 , IImHxL2 I2 ReHxL2 - 2 ReHxL + 1M + ImHxL4 + HReHxL - 1L2 ReHxL2 M - log ImHxL2 + HReHxL - 1L2 + ReHxL - 1 + logI, IImHxL2 I2 ReHxL2 - 2 ReHxL + 1M + ImHxL4 + HReHxL - 1L2 ReHxL2 M + ImHxL2 + ReHxL2 - ReHxLM 32 J2 IImHxL2 + HReHxL - 1L2 M N Ugh! Simplify@%D - Hx - 1L HReHxL - 1L ImHxL2 + HReHxL - 1L2 - ReHxL , IImHxL2 I2 ReHxL2 - 2 ReHxL + 1M + ImHxL4 + HReHxL - 1L2 ReHxL2 M - ImHxL2 , IImHxL2 I2 ReHxL2 - 2 ReHxL + 1M + ImHxL4 + HReHxL - 1L2 ReHxL2 M - log ImHxL2 + HReHxL - 1L2 + ReHxL - 1 + logI, IImHxL2 I2 ReHxL2 - 2 ReHxL + 1M + ImHxL4 + HReHxL - 1L2 ReHxL2 M + ImHxL2 + ReHxL2 - ReHxLM 32 J2 IImHxL2 + HReHxL - 1L2 M N To see if this is correct, try to evaluate it at x = 1 and see if we get (1/2) 1 |1| = 1/2: 6 Integration.nb % . x ® 1 1 Power::infy : Infinite expression encountered. 032 ¥::indet : Indeterminate expression -¥ + ¥ encountered. Indeterminate It appears that Mathematica has created an expression involving the variable x that it can't evaluate for any particular value of x! Human-computer collaboration on a definite integral How does Mathematica do with that u = x ln x example? Integrate@H1 + Log@xDL Sqrt@1 - Hx * Log@xDL ^ 2D, 8x, 0.9, 1.1<D 1.1 à HlogHxL + 1L 1 - x2 log2 HxL â x 0.9 It takes Mathematica half a minute or so to find this (useless) answer. When we ask Mathematica to do this integral numerically, we get an answer quickly. N@%D 0.199331 And this seems to be right, if we apply the Evaluation Theorem using the antiderivative we found before: HH1 2L HArcSin@x Log@xDD + x Log@xD Sqrt@1 - x ^ 2 Log@xD ^ 2DL . x ® 1.1L HH1 2L HArcSin@x Log@xDD + x Log@xD Sqrt@1 - x ^ 2 Log@xD ^ 2DL . x ® 0.9L 0.199331 For some ideas about how did Mathematica might have done the calculation of the definite integral (without knowledge of the antiderivative), see section 6.5 of Stewart, which discusses numerical methods of integration.
© Copyright 2026 Paperzz