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

Mathematica Another bug? Weird integration results.

  1. Apr 16, 2016 #1

    Hepth

    User Avatar
    Gold Member

    I can't upload the notebook I guess, that would be a nice feature mods! (.nb extension)

    But here is my code , there seems to be a problem with integrating separately and then combining.

    Code (Text):

    $Assumptions = 0 < r < 1 && 0 < z < 1;
    FUNCTION = Expand[-(Pi*(-1 + r)*(-12*z + r^2*z + r*(-12 + 11*z)))/(12*(r*(-1 + z) - z))];
    temp1 = Table[Integrate[FUNCTION[[i]], z, Assumptions -> $Assumptions], {i, 1, Length[FUNCTION]}] // Total // Expand
    temp2 = Integrate[FUNCTION, z, Assumptions -> $Assumptions] // Expand
    temp1 /. {r -> 1/16., z -> 0.1}
    temp2 /. {r -> 1/16., z -> 0.1}
     
    So the problem is that if I choose each piece of the function, integrate them individually, its not the same result as if i do the whole integration.

    This is on MM9 right now. Can anyone confirm this? My results are

    0.297957 -0.620063 I
    0.495329 -0.00321276 I
     
  2. jcsd
  3. Apr 16, 2016 #2

    Hepth

    User Avatar
    Gold Member

    Wow it really is just something with not fullsimplifying the function first :

    Code (Text):

    FUNCTION = (-12*z + r^2*z + r*(-12 + 11*z))/(12*(r*(-1 + z) - z));
    Integrate[   Simplify[FUNCTION,   0 < r < 1 && 0 < z < 1], z] /. {r -> 1/16, z -> 1/10} // N
    Integrate[   FullSimplify[FUNCTION,   0 < r < 1 && 0 < z < 1], z] /. {r -> 1/16, z -> 1/10} // N
     
    0.168179 -0.00109083 I

    0.101165
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted