MathGroup Archive 2003

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

Search the Archive

Re: Kernel Timeout

  • To: mathgroup at smc.vnet.net
  • Subject: [mg42954] Re: Kernel Timeout
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Wed, 6 Aug 2003 03:16:30 -0400 (EDT)
  • References: <bgfseh$lld$1@smc.vnet.net>
  • Reply-to: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Sender: owner-wri-mathgroup at wolfram.com

"T.Srinivas Kumar" <tskumar at india.com> wrote in message
news:bgfseh$lld$1 at smc.vnet.net...
> Hello,
>
> How can one can set a timeout period for the Mathematica Kernel. I mean,
can we launch Kernel from Mathematica Frontend with a timeout period, may be
for 10 seconds so that it gets killed/stopped after 10 seconds? I should
also be able to do my computations within Mathematica within this 10
seconds.
>
> Please let me know the procedure if this is possible.
>
> Regards
> T.Srinivas Kumar
> --
> ______________________________________________
> http://www.india.com
> Now with POP3/SMTP access for only US$14.95/yr
>
> Powered by Outblaze
>

For individual inputs

Evaluating

    ?*Time*

gives all commands including Time.

Amongst these we find TimeConstrained, which can be used as follows.

In[1]:=
    TimeConstrained[Integrate[Sin[x^5 + x^3], x], .0001, "Out of time"]
Out[1]=
    Out of time

To have this happen automatically for all inputs we can use

In[2]:=
    $Pre = Function[x, TimeConstrained[x, .0001, "Out of time"],
            HoldAll];

Example:
In[3]:=
    Integrate[Sin[x^5 + x^4], x]
Out[3]=
    Out of time

We can cancel $Pre
In[4]:=
    $Pre =.

--
Allan
---------------
Allan Hayes
hay at haystack.demon.co.uk
Voice: +44 (0)116 241 8747
Fax: +44 (0)870 164 0565








  • Prev by Date: Re: New options in 5.0
  • Next by Date: Re: Re: Background Colors in The Format Menu
  • Previous by thread: Kernel Timeout
  • Next by thread: Re: Re: Kernel Timeout