Why does Wolfram often produces "extra" constant terms when integrating?

145 Views Asked by At

This question was just asked on MSE about the result the OP got for $$\int \frac{7x}{(2x+1)} dx$$ OP got the result $$\frac{7x}{2}-\frac{7}{4}\ln(|2x+1|)+C$$ and Wolfram gives $$\frac{7}{4} (2 x - \ln(2 x + 1) +1)+ C$$ Reading @SimplyBeautifulArt's comment on it I was also wondering why very often when checking the result of an indefinite integral with Wolfram, the computer produces answers that contain "extra" terms that are "hidden" in the arbitrary constant when computing the integral by hand with good old brain power.

When looking at the "step by step" solution Wolfram provides, most of the time it suggests the use of the same strategy one would use by hand namely, substitutions and power reducing formulas for example. Does the computer follow the steps it suggests or does it know that it is presenting these steps to a human?

2

There are 2 best solutions below

1
On BEST ANSWER

It depends on what you call an "extra constant". If you are integratng $(x-1) dx$, you could get $(1/2)(x^2-2x)+C$ with a term-by-term integeation, or you could get $(1/2)u^2+C=(1/2)(x^2-2x+1)+C$ by substituting $u=x-1$. Which is the extra constant, the $+1/2$ in the second expression or the $-1/2$ we get if we render the first expression as $(1/2)(u^2-1)+C$? It depends on the point of view you adopt, not on any intrinsic property of the function.

When Wolfram integrates ${(7x)dx}/{2x+1}$, it likely puts in $u=2x+1$, which leads to $(7/4)(u-\log u)+C$. Wolfram puts this back into terms of $x$ and we think there is an extra constant, but the expression in terms if $u$ from which the answer is derived has no such term.

0
On

Following @Rahul's comment I went and found a straight answer to the question How does Mathematica Integrate? on Mathematica SE.

I thought I could place a copy of it here so that others can see it, here is @Mr. Wizard's answer :

I can only direct you to Some Notes on Internal Implementation:

Differentiation and Integration

Differentiation uses caching to avoid recomputing partial results.

For indefinite integrals, an extended version of the Risch algorithm is used whenever both the integrand and integral can be expressed in terms of elementary functions, exponential integral functions, polylogarithms, and other related functions.

For other indefinite integrals, heuristic simplification followed by pattern matching is used.

The algorithms in Mathematica cover all of the indefinite integrals in standard reference books such as Gradshteyn-Ryzhik.

Definite integrals that involve no singularities are mostly done by taking limits of the indefinite integrals.

Many other definite integrals are done using Marichev-Adamchik Mellin transform methods. The results are often initially expressed in terms of Meijer G functions, which are converted into hypergeometric functions using Slater's theorem and then simplified.

Integrals over multidimensional regions defined by inequalities are computed by iterative decomposition into disjoint cylindrical or triangular cells.

Integrate uses about 500 pages of Mathematica code and 600 pages of C code.

-Mr. Wizard