Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica Mistake?

  1. Sep 17, 2009 #1
    There is something pretty strange going on with mathematica right now.

    When I do the following function
    Code (Text):
    Integrate[(n x + 1)^2,x]
    I get the result
    Expanded this is
    [tex]\frac{1}{3 n}+x+n x^2+\frac{n^2 x^3}{3}[/tex]

    However this is not the result I get if I integrate the individual parts of the expansion
    and add the results of the integrals
    Code (Text):
    Integrate[n^2 x^2, x] + Integrate[2*n*x, x] + Integrate[1, x]
    which gives me
    [tex]x+n x^2+\frac{n^2 x^3}{3}[/tex]

    Please tell me I am missing somthing obvious and mathematica isn't making a mistake?
  2. jcsd
  3. Sep 17, 2009 #2


    User Avatar
    Science Advisor
    Homework Helper

    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 [itex](nx + 1)^2[/itex].
  4. Sep 17, 2009 #3
    Granted it is allowed, why would it choose such an esoteric constant? Like you said I didn't provide it any boundary conditions, so whats 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.
  5. Sep 17, 2009 #4


    Staff: Mentor

    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).
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Threads - Mathematica Mistake Date
Mathematica Cannot do the integral of the Hyper-geometric function? Mar 11, 2018
Mathematica Cannot Plot This Function in Mathematica Feb 26, 2018
Mathematica While Loop in Mathematica Feb 25, 2018
Mathematica Mathematica Real Part Feb 24, 2018
Where is my mistake in this MATLAB code? Oct 25, 2012