Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: Re: Looping

  • To: mathgroup at smc.vnet.net
  • Subject: [mg95958] Re: [mg95896] Re: Looping
  • From: Adam Strzebonski <adams at wolfram.com>
  • Date: Fri, 30 Jan 2009 05:48:12 -0500 (EST)
  • References: <glmt16$mqu$1@smc.vnet.net> <200901291056.FAA18117@smc.vnet.net> <96061AD3-433E-4217-AC48-C21E57BB602F@mimuw.edu.pl>
  • Reply-to: adams at wolfram.com

Andrzej Kozlowski wrote:
> 
> 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
>> http://www.dbaileyconsultancy.co.uk
>>
> 
> 
> 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
> 

Yes, Simplify and FullSimplify have built in protection against
infinite loops, but no global time limit.

The TimeConstraint option specifies a time limit allowed for a single
transformation. If the time limit expires the current transformation
is aborted, but then (Full)Simplify will attempt other transformations
with a fresh time allowance for each new transformation. The default
value of TimeConstraint is 5 minutes for Simplify and Infinity for
FullSimplify.

Best Regards,

Adam Strzebonski
Wolfram Research




  • References:
    • Re: Looping
      • From: David Bailey <dave@removedbailey.co.uk>
  • Prev by Date: Re: ListCurvePathPlot
  • Next by Date: Re: Series expansion of x_n=Tan[x_n]
  • Previous by thread: Re: Re: Looping
  • Next by thread: Re: Re: Looping