MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Looping

  • To: mathgroup at
  • Subject: [mg95930] Re: [mg95896] Re: Looping
  • From: Andrzej Kozlowski <akoz at>
  • Date: Fri, 30 Jan 2009 05:43:05 -0500 (EST)
  • References: <glmt16$mqu$> <>

On 29 Jan 2009, at 11:56, David Bailey wrote:

> Jeff Albert wrote:
>> I have a program written in Mathematica that has been running now  
>> for about three days.  How can I tell if it's in a loop?
> The best approach is to start small, and work your way up to a big
> problem like that if necessary. Start by aborting the calculation and
> then start testing much smaller examples.
> Some Mathematica functions - such as Simplify or FullSymplify - seem  
> to
> get stuck in this sort of way - if they do that, they will hang for  
> ever.
> David Bailey

I doubt very much that they they ever get "stuck" in the way you  
describe. Both Simplify and FullSimplify make use of algebraic  
algorithms some of which have very high complexity (e.g. exponential  
or even double exponential in the number of variables). Even when it  
seems that the expression you are simplifying involves only a few  
variables, its algorithmic complexity may be high because  
transcendental parts of expressions are often treated as independent  
variables. Of course, the human time scale: minutes, hours, lifetimes,  
has not particular place in computer algebra so there is no reason at  
all why your program should not run for 10 years and then suddenly  
come up with an answer.
In fact, I believe Simplify and FullSimplify have some built in  
protection against infinite loops so they are probably somewhat less  
likely to fall into them than some other functions. Also, note that  
both Simplify and FullSimplify have the option TimeConstraint, which  
can be sometimes useful in dealing with complex expressions. If you  
run FullSimplify on an expression with TimeConstraint set to, say, an  
hour, and if it returns to you the same expression that you originally  
gave to it as input, it won't necessarily mean that it had entered an  
infinite loop but more likely that it had attempted a transformation  
or a sequence of transformations which it could not complete before  
the time limit expired.

Andrzej Kozlowski

  • References:
    • Re: Looping
      • From: David Bailey <>
  • Prev by Date: Re: O in Mathematica
  • Next by Date: Re: ListCurvePathPlot
  • Previous by thread: Re: Looping
  • Next by thread: Re: Re: Looping