Message Boards Message Boards


Integration in Mathematica 9

Posted 9 years ago
8 Replies
2 Total Likes

I am trying the following two integrals (college computer, with Mathematica 9)

Integrate[(p^2)/(p^2 - Subscript[E, 1] m), {p, 0, \[CapitalLambda]}]


Integrate[(p^2)/((p^2 - Subscript[E, 1] m) (p^2 + m^2)), {p, 0, \[CapitalLambda]}]

I have the following questions: [1. ] Why does Mathematica 9 start all notebooks as "Untitled-1 (Debug)", in Mathematica 8, a new notebook doesn't show "Debug" [2. ] On Mathematica 8 on Linux (32 GB RAM), the evaluation takes a minute or so. On the college Windows XP machine - 4 GB RAM, it has still not provided the answer after 30 minutes. [3. ] The answers (from Linux) appear unnecessarily complicated. Is there a way to force Mathematica to use partial fractions i.e. nudge it in a way that humans would solve these two integrals?

POSTED BY: Yaj Bhattacharya
8 Replies

In general, please specify the domain that you work with real numbers (instead of complex) (I presume you need only real numbers):

Integrate[(p^2)/(p^2 - Em), {p, 0, \[CapitalLambda]}, Assumptions -> (\[CapitalLambda] \[Element] Reals \[And] Em \[Element] Reals)]

then after a few seconds:

ConditionalExpression[\[CapitalLambda]-Sqrt[Em] ArcTanh[\[CapitalLambda]/Sqrt[Em]],\[CapitalLambda]>0&&Em>\[CapitalLambda]^2]

The solution will be much more complicated if you consider complex numbers or the possibility of Em to be complex. Then you have to think even more about branch cuts et cetera.

This is not a simple integral ;) I'm curious how you would do it by hand...

POSTED BY: Sander Huisman

The integrals (especially the first one) is pretty straightforward if done by partial fractions -- indicated in my earlier mail.

p^2/(p^2 - k^2) = (p^2 + k^2 - k^2)/((p + k) (p - k)) = 1 + k^2/((p + k) (p - k))

For certain cases where Em < 0, one of the integrals diverge.

In a couple of my earlier posts, I have indicated where Mathematica can't perform certain simple integrals over DiracDelta functions. My guess is one has to be cautious with expectations of "symbolic computation capabilities" of Mathematica, no matter what it was meant for :-)

POSTED BY: Yaj Bhattacharya
Posted 9 years ago

There are hundreds of pages, probably more than that, of very complicated code that we will never get to see. All that code has to deal with the vast number of different integrals that you might throw at it. The methods used in all that code are very different from the handful of sometimes trial and error methods that are taught to first or second year students. Students are sometimes frustrated when they cannot get to see Mathematica solve problems the way they were taught to solve them, or the way they want to see them solved so they can learn to do it themselves or just turn in as homework.

Mathematica was never intended to solve problems the way beginning students are taught. There have been attempts in the past to create programs that solve problems the way students do, but I don't think those were able to solve more complicated problems.

POSTED BY: Bill Simpson
Posted 9 years ago


In[1]:= Assuming[X > 0 && X^2 < k^2, Simplify[Integrate[1 + Em/((p - k) (p + k)), {p, 0, X}]]]

Out[1]= X - (Em ArcTanh[X/k])/k
POSTED BY: Bill Simpson

Thanks very much Bill !

I am wondering why Mathematica can't do such a simple integral by partial fractions

Integrate[p^2/(p^2 - Em), p] 

* by partial fractions as in

p^2/(p^2 - k^2) = (p^2 + k^2 - k^2)/((p + k) (p - k)) = 1 + k^2/((p + k) (p - k))

This is really embarrassing (if Mathematica can't do this), unless I am missing something here.

POSTED BY: Yaj Bhattacharya

My Mathematica can do:

Integrate[p^2/(p^2 - Em), p]


p-Sqrt[Em] ArcTanh[p/Sqrt[Em]]

No problem.

POSTED BY: Sander Huisman
Posted 9 years ago

For your question 2 only:

Almost always a new version of Mathematica introduces new more complicated rules to deal with examples that were found when using the previous version. These new rules sometimes slow calculations down in exchange for being able to correctly handle more examples.

Sometimes providing it with some hints about what you are assuming, perhaps without even thinking about it, can help. For example, telling it that your variables are all Reals can often enable it to provide a simpler result or sometimes find the result more quickly.

Sometimes the compulsion to use subscripted variables and special characters can cause problems. But in your example this doesn't seem to make a difference.

In[5]:= Assuming[{p, E1, m, lambda} \[Element] Reals,  Integrate[(p^2)/(p^2 - E1 m), {p, 0, lambda}]]

Out[5]= ConditionalExpression[lambda - Sqrt[E1] Sqrt[m] ArcTanh[lambda/( Sqrt[E1] Sqrt[m])],
    (lambda == (E1 m)/lambda || (E1 m)/lambda == 0 || (E1 m)/lambda^2 >= 1 || (E1 m)/lambda^2 <= 0) && lambda >= 0]

That says the result is an ArcTanh, just as long as lambda >=0. Try adding that as an assumption to help simplify.

In[6]:= Assuming[{p, E1, m, lambda} \[Element] Reals && lambda >= 0, Integrate[(p^2)/(p^2 - E1 m), {p, 0, lambda}]]

During evaluation of In[6]:= Integrate::idiv: Integral of p^2/(-E1 m+p^2) does not converge on {0,lambda}. >>

Out[6]= \!\(\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(lambda\)]\(
    \*FractionBox[SuperscriptBox[\(p\), \(2\)], \(\(-E1\)\ m + \*SuperscriptBox[\(p\), \(2\)]\)] \[DifferentialD]p\)\)

So when you tell it the assumption that it just told you it then says it can't find the integral anymore. Sigh.

Your second example behaves exactly the same way.

Perhaps you know better what you might be assuming and this might help simplify, and possibly even speed up a little, finding a solution.

POSTED BY: Bill Simpson

OK, here is the first integral without any assumptions (done in Mathematica 8), here [CapitalLambda] has been substituted by "X" to make it look better on the post, and k^2 = Em, assuming k greater than 0 ).

Integrate[1 + Em/((p - k) (p + k)), {p, 0, X}]

The result (in Mathematica 8) is

ConditionalExpression[X - (Em ArcTanh[X/k])/k, Re[X] >= 0 && Im[X] == 0 && (Re[k^2/X^2] >= 1 || Re[k^2/X^2] <= 0 || k^2/X^2 \[NotElement] Reals)]

How could I get so many conditions (syntax) in the input itself so the output is not this crowded?

POSTED BY: Yaj Bhattacharya
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract