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

Mathematica : Integrate and a Log problem?

  1. Mar 3, 2014 #1


    User Avatar
    Gold Member

    Here is the code, I am using Mathematica 7 with no packages installed at the moment.

    Code (Text):

    $Assumptions = 0 < u <= 19/80 && I10 \[Element] Reals;
    FXN = Sqrt[(u - 15/16)^2 - 2/5 (u + 17/16) + 1/25] (I10 (u^2) - 1/u);
    PA = Integrate[FXN /. {I10 ->  1/2 Log[1/2]}, u];
    PB = Integrate[FXN, u] /. {I10 -> 1/2 Log[1/2]};
    Plot[{Re[PA], Re[PB]}, {u, 0, 0.243}]

    PA = Integrate[FXN /. {I10 -> 0.5  Log[1/2]}, u];
    PB = Integrate[FXN, u] /. {I10 ->  0.5 Log[1/2]};
    Plot[{Re[PA], Re[PB]}, {u, 0, 0.243}]
    What I am doing is finding the upper limit of an integral. If I make a replacement of a variable to a constant before or after the integration I get different results. The constant is not complex, and is a real number, though contains a Log[1/2].

    I know the Sqrt in FXN is only real for u<0.243 ish, and my limit of integration is right below that.
    I have tried limits too, and its the same as just a replacement rule.

    NOTICE, if you change the 1/2 to 0.5 in the replacement rule it works.

    Is there a way I can get these to be the same no matter what?
  2. jcsd
  3. Mar 3, 2014 #2
    Can you be more specific about what expression you want to find?

    If I do this

    Code (Text):
    $Assumptions = 0 < u <= 19/80 && I10 \[Element] Reals;
    FXN = Sqrt[(u - 15/16)^2 - 2/5 (u + 17/16) + 1/25] (I10 (u^2) - 1/u);
    PA1 = Integrate[FXN /. {I10 -> 1/2 Log[1/2]}, u];
    PB1 = Integrate[FXN, u] /. {I10 -> 1/2 Log[1/2]};
    PA2 = Integrate[FXN /. {I10 -> 0.5 Log[1/2]}, u];
    PB2 = Integrate[FXN, u] /. {I10 -> 0.5 Log[1/2]};
    Plot[{Re[PA1], Re[PB1], Re[PA2], Re[PB2]}, {u, 0, 0.243}]
    the four plots look like they lie on top of each other, at least with MMA 9.

    Can you write

    This expression <> and this expression <> differ at the 4th (or 20th) digit. Why?

  4. Mar 3, 2014 #3


    User Avatar
    Gold Member

    Ok. In MM7 I get this plot :


    Maybe it was a bug that was fixed in MM8 or 9. Its not off by precision, but by some actual REAL amount. The problem I noted on my MM7 Ubuntu machine at work, and just now im posting this from my windows 7 netbook at home, that uses a different kernel.

    Time to upgrade I guess.
  5. Mar 3, 2014 #4
    Unfortunately I lost a machine and so I don't have versions 5.2, 6, 7 and 8 to try this on. Perhaps you could ask nicely in another place if someone else could compare the results with 7 and 9 and see if they can confirm your results. That might save an upgrade if there is some other reason for this.
  6. Mar 3, 2014 #5


    User Avatar
    Gold Member

    I actually have the license for up to 9, I just didn't like the autocomplete feature when programming when I had 9 on another machine so I never changed it on my new ones. I guess Ill do this tomorrow, as my research depends on it. Thanks for your help. I'm always glad its not something that I am misunderstanding.
  7. Mar 3, 2014 #6
    How to permanently turn off the predictive interface


    I'm running with the predictive interface turned off until they fix some problems where this can make it use all available memory and swap space given some seemingly simple problems.

    You should check details carefully to make certain you don't lose anything, but it has been possible to have multiple versions happily installed on the same machine. You can't run those at the same time, but I have had great use of being able to switch back to a previous version to check something.

    If you can do that then you can use 7 for almost everything and then just check with 9 when there is a question.
  8. Mar 4, 2014 #7


    User Avatar
    Gold Member

    Thanks. I'll install 9 and turn off predictive. The problem is that this little part is a representation of what Im actually integrating (pages long of algebraic form), and happened to be the piece with a problem. Its unfortunate as I have spent weeks running high precision integrations over a large phase space, only to see this when commenting my code. (The output just didn't look algebraically right, as it was putting that I10 into a logarithm after integration, and its solely multiplicative).
    I can avoid this for now by just replacing everything at the start, and maybe check some of my data.

    Thanks again for your help.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook