• adding timelimit to CAS calls to integrate when CAS does not support bu

    From Nasser M. Abbasi@21:1/5 to All on Fri Jan 26 00:48:27 2024
    FYI;

    I run some tests using different CAS systems that do not support
    setting a timelimit on its calls.

    For example Reduce and Fricas and Maxima and GIAC and others.

    For me, timelimit() is the most important function, as without
    it, it is very easy to make any CAS hang. Yet, strangely
    open source CAS systems do not have such a basic function as
    a built-in.

    They do not have a direct way to insure a call to some command
    such as integrate should not take more than say 30 seconds and
    to return an error if the call exceeds this timelimit.

    Commercial CAS systems Maple and Mathematica have an easy to use
    built-in command for this. This document is meant to describe how
    to add timelimit to other systems that do not support this.

    This method only works and have been tested on Linux.

    I found this method to be reliable and works well. It is
    based on using the Linux command timeout and using
    Python's subprocess.Popen().

    Python is used as the main driver for all these scripts.

    <https://12000.org/my_notes/faq/time_out_cas/index.htm>

    --Nasser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From nobody@nowhere.invalid@21:1/5 to Nasser M. Abbasi on Fri Jan 26 09:45:26 2024
    "Nasser M. Abbasi" schrieb:

    I run some tests using different CAS systems that do not support
    setting a timelimit on its calls.

    For example Reduce and Fricas and Maxima and GIAC and others.

    For me, timelimit() is the most important function, as without
    it, it is very easy to make any CAS hang. Yet, strangely
    open source CAS systems do not have such a basic function as
    a built-in.

    They do not have a direct way to insure a call to some command
    such as integrate should not take more than say 30 seconds and
    to return an error if the call exceeds this timelimit.


    Presumably nobody felt the need for this back when these systems were
    conceived because they were meant for console operation and a
    computation could always be interrupted with Control-C or similar.


    [...]


    Martin.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Nasser M. Abbasi@21:1/5 to clicliclic@freenet.de on Fri Jan 26 03:11:50 2024
    On 1/26/2024 2:45 AM, clicliclic@freenet.de wrote:

    "Nasser M. Abbasi" schrieb:

    I run some tests using different CAS systems that do not support
    setting a timelimit on its calls.

    For example Reduce and Fricas and Maxima and GIAC and others.

    For me, timelimit() is the most important function, as without
    it, it is very easy to make any CAS hang. Yet, strangely
    open source CAS systems do not have such a basic function as
    a built-in.

    They do not have a direct way to insure a call to some command
    such as integrate should not take more than say 30 seconds and
    to return an error if the call exceeds this timelimit.




    Presumably nobody felt the need for this back when these systems were conceived because they were meant for console operation and a
    computation could always be interrupted with Control-C or similar.


    Ok, but isn't the birth of Mathematica and Maple is around same
    time frame as these other open source CAS systems? Mathematica
    was born in 1988, and Maple in 1982. Sure, Reduce and Maxima
    and Fricas are few years older, but not by much. May be 10 years?

    Sympy is also a much younger CAS than all of them and it
    has no timelimit() command. Also mupad has no timelimit()
    built-in and I had to do many ticks in Matlab to implement it.

    In Mathematica, TimeConstrained has date of 1988 on it.

    <https://reference.wolfram.com/language/ref/TimeConstrained.html>

    Also, open source CAS systems had all the time to add
    such a built-in function since the 1970's or 1980's?

    Btw, Maple timelimit() also has some problems I complained
    about before. It does not always work (i.e. terminate
    the call at the time requested). I could ask for 30 seconds
    time limit, and it could terminate after 5 minutes or 10.

    So even Maplesoft still needs to work/improve its
    timelimit() function.

    I found Mathematica's TimeConstrained function very robust
    and always works and stops the call at the time limit requested.

    --Nasser


    [...]


    Martin.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Nasser M. Abbasi@21:1/5 to Nasser M. Abbasi on Fri Jan 26 13:59:39 2024
    Fyi;

    I was told that Fricas now has timeout which is good. I did not
    know about it. First open source CAS to have timeout !

    https://fricas.github.io/api/TimeoutPackage.html#index-1

    ----------------
    eval_with_timeout: (() -> S, Integer) -> Union(S, failed)
    eval_with_timeout(f, t) calls f with timeout of t seconds.
    Returns value computed by f or “failed” if f did not finish within t seconds.
    -------------------

    --Nasser

    On 1/26/2024 3:11 AM, Nasser M. Abbasi wrote:
    On 1/26/2024 2:45 AM, clicliclic@freenet.de wrote:

    "Nasser M. Abbasi" schrieb:

    I run some tests using different CAS systems that do not support
    setting a timelimit on its calls.

    For example Reduce and Fricas and Maxima and GIAC and others.

    For me, timelimit() is the most important function, as without
    it, it is very easy to make any CAS hang. Yet, strangely
    open source CAS systems do not have such a basic function as
    a built-in.

    They do not have a direct way to insure a call to some command
    such as integrate should not take more than say 30 seconds and
    to return an error if the call exceeds this timelimit.




    Presumably nobody felt the need for this back when these systems were
    conceived because they were meant for console operation and a
    computation could always be interrupted with Control-C or similar.


    Ok, but isn't the birth of Mathematica and Maple is around same
    time frame as these other open source CAS systems? Mathematica
    was born in 1988, and Maple in 1982. Sure, Reduce and Maxima
    and Fricas are few years older, but not by much. May be 10 years?

    Sympy is also a much younger CAS than all of them and it
    has no timelimit() command. Also mupad has no timelimit()
    built-in and I had to do many ticks in Matlab to implement it.

    In Mathematica, TimeConstrained has date of 1988 on it.

    <https://reference.wolfram.com/language/ref/TimeConstrained.html>

    Also, open source CAS systems had all the time to add
    such a built-in function since the 1970's or 1980's?

    Btw, Maple timelimit() also has some problems I complained
    about before. It does not always work (i.e. terminate
    the call at the time requested). I could ask for 30 seconds
    time limit, and it could terminate after 5 minutes or 10.

    So even Maplesoft still needs to work/improve its
    timelimit() function.

    I found Mathematica's TimeConstrained function very robust
    and always works and stops the call at the time limit requested.

    --Nasser


    [...]


    Martin.


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)