Message Boards Message Boards

Would someone take a moment (Integrate hang)

Posted 10 years ago
Or perhaps this is somehow all my fault.

Someone asked me if I could verify this for them and I'm seeing what they were seeing.

Start Mathematica.

In[1]:= $Version
Out[1]= "9.0 for Microsoft Windows (64-bit) (January 25, 2013)"

(with the task manager running to watch peak memory use}

Mathematica.exe 87,000k
MathKernel.exe 69,656k
Mathkernel.exe 57,468k

Nothing surprising. Evaluate this expression
 In[1]:= x1 = I w; x2 = 2 I w;
 Integrate[E^(I x t)/((x - x1) (x - x2)), {x, -Infinity, Infinity}]
 Out[2]= ConditionalExpression[(1/w)(I Cosh[2 w Abs[t]] CosIntegral[-2 I w Abs[t]] - I Cosh[2 w Abs[t]]
   CosIntegral[2 I w Abs[t]] - \[Pi] Cosh[w Abs[t]] Sign[t] + \[Pi] Cosh[2 w Abs[t]] Sign[t] + \[Pi]
   Sinh[w Abs[t]] + I CosIntegral[I w Abs[t]] (Cosh[w Abs[t]] - Sign[t] Sinh[w Abs[t]]) + I
   CosIntegral[-I w Abs[t]] (-Cosh[w Abs[t]] + Sign[t] Sinh[w Abs[t]]) - \[Pi] Sinh[2 w Abs[t]] -
   I CosIntegral[-2 I w Abs[t]] Sign[t] Sinh[2 w Abs[t]] + I CosIntegral[2 I w Abs[t]] Sign[t]
   Sinh[2 w Abs[t]]), t \[Element] Reals && Re[w] != 0]

Mathematica.exe 91,432k
MathKernel.exe 137,356k
Mathkernel.exe 57,468k

Nothing surprising. It does that quickly every time I've tried that.

Now add a relevant simple assumption and evaluate.
In[3]:= x1 = I w; x2 = 2 I w;
Integrate[E^(I x t)/((x - x1) (x - x2)), {x, -Infinity, Infinity}, Assumptions -> {t > 0, w > 0}]

Out[4]= -((2 E^(-2 t w) (-1 + E^(t w)) \[Pi])/w)

The result displays quickly, the system appears to be idle and then memory use begins to climb rapidly until

Mathematica.exe 92,240k
MathKernel.exe 3,494,244k
Mathkernel.exe 57,868k

and the system appears to hang, apparently busy consuming all available memory and swap space. All programs are "not responding."

If I don't touch the keyboard for a few minutes or longer sometimes the displays will black out and sometimes return,
sometimes minutes later the memory currently used, as opposed to peak values, will decline back to a few times nominal values
and sometimes the system will again be responsive, but often it seems that the system is still substantially slower than before.

It doesn't seem to necessarily happen every time, but most times this seems to happen and I've tried this dozens of ways.
It does not appear to require Integrate. If neither or only one of the assumptions is used I haen't seen this happen.
Simplify and FullSimplify with both assumptions appears to also be able to reproduce this.

Not realizing what is going on and trying to use the keyboard or mouse to sieze control only appears to compound the problem.
Restarting the machine and restarting Mathematica do not change the behavior.

Has his little example somehow corrupted my Mathematica or my machine?
Or is this all my fault and I've done something to make this happen?
I've never seen particular "unexpected behavior" like this.

I vaguely remember some comment from a few years ago about how having a dual core machine and/or a newer
version of Mathematica would overcome the difficulty with Version 5.2 where a run-away calculation could consume
so many resources that it was difficult or nearly impossible to get control to be able to kill the kernel.
I haven't noticed the ability to do that with Version 9 and an I5-750 processor.  Is that some mistake I'm making?

Thank you
POSTED BY: Bill Simpson
3 Replies
Problem report filed.

Thank you for bringing it to our attention.
POSTED BY: Bruce Miller
Partly duplicated with 9.0.1 on MacOS 10.8.5.
I was able to use Evaluation menu - Quit Kernel to stop the Kernel, but it took about 10 seconds.

No problem with Predictive Interface OFF.
POSTED BY: Bruce Miller
This sounds like an issue with the predictive interface. This may be resolved by turning it off. You can read how to do this at

Whether that resolves the issue or not, it would help to report this to
POSTED BY: Jason Grigsby
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract