Mathematica Mathematica Mistake? Solve Puzzling Integration Issue

AI Thread Summary
The discussion centers around an unexpected result from Mathematica when integrating the function (n x + 1)^2. The integral yields a result that includes a constant term, specifically \frac{1}{3 n}, which is not present when integrating the individual components of the expansion separately. The confusion arises from the nature of integration, which allows for the inclusion of a constant term when no boundaries are specified. It is clarified that both results are valid since they differentiate back to the original function, and the constant is a consequence of applying the chain rule. The main point of contention is the lack of explicit mention of this constant in the output, which some users find unusual for the software's behavior.
keniwas
Messages
57
Reaction score
1
There is something pretty strange going on with mathematica right now.

When I do the following function
Code:
Integrate[(n x + 1)^2,x]

I get the result
\frac{(1+nx)^3}{3n}
Expanded this is
\frac{1}{3 n}+x+n x^2+\frac{n^2 x^3}{3}

However this is not the result I get if I integrate the individual parts of the expansion
(nx+1)^2=1+2nx+n^2x^2
and add the results of the integrals
i.e.
Code:
Integrate[n^2 x^2, x] + Integrate[2*n*x, x] + Integrate[1, x]

which gives me
x+n x^2+\frac{n^2 x^3}{3}

Please tell me I am missing somthing obvious and mathematica isn't making a mistake?
 
Physics news on Phys.org
If you integrate w.r.t x, then 1/(3n) is a constant. You have not given integration boundaries, so this is allowed. In other words, since D[1/(3n), x] = 0, both results differentiate back to (nx + 1)^2.
 
Granted it is allowed, why would it choose such an esoteric constant? Like you said I didn't provide it any boundary conditions, so what's so special about this constant? It seems rather unusal to me, and its not a behavior I have seen from the software before when performing integration that I am aware of.
 
The constant is not particularly esoteric. It is a direct result of applying the chain rule to (n x + 1)^2. In any case, as mentioned above integration is only defined up to a constant, so there is no mistake here other than the fact that the constant is not explicitly mentioned (which I think it should do).
 

Similar threads

Replies
1
Views
2K
Replies
13
Views
2K
Replies
2
Views
1K
Replies
19
Views
2K
Replies
2
Views
2K
Replies
1
Views
2K
Replies
2
Views
2K
Replies
9
Views
3K
Back
Top