How to crash reduce instantly

  • James

    James - 2009-10-10

    As a new user, naively type in the following:

    1: 5!<return>

    but then, oops, you forget the semicolon:

    1: ;<return>

    That's it.  Reduce will never return.  "ps" says reduce is in state S, "Interruptible sleep (waiting for an event to complete)".

    This is not a good experience for the naive new user.  And, just as bad, the operator "factorial" is not "discoverable" through this naive action of typing "!".

    Perhaps entering the character "!", outside of any legitimate context, should trap to an error message about using the operator "factorial" for calculating the factorial of a number.


  • James

    James - 2009-10-12

    Well, here's another.  I was looking through "DRAFT: Comparing the speed of programs for sparse polynomial multiplication" by Richard Fateman, July 2, 2002, where he asks "How should one program the multiplication of sparse polynomials?" and examines  p^20 = (1+x+y+z)^20.  There is a particular reference to results produced by Reduce, using the code

    on time;

    which is all good and well, since it seems to run without problem.

    But, if instead, we simply look at the result


    then bad things happen.

    First, on the command line, Reduce outputs

    Unrecognised keyword "\math"

    and, in the Reduce window, there can be seen, amidst all the polynomial coefficients, "malformed expression".

    If you then scroll upward through the output in the Reduce window, on the command line, Reduce will begin to output additional error messages, and then, finally, terminate altogether, closing the Reduce window.

    The resulting command line messages look like this:

    Unrecognised keyword "\math"

    "}" not found

    Unrecognised keyword "\math"

    Unrecognised keyword "\math"

    TeX syntax problem

    "{" expected after keyword "\mathrm"

    Unrecognised keyword "\math"

    Unrecognised keyword "\m"

    "{" expected after keyword "\mathrm"

    "{" expected after keyword "\mathrm"

    Unrecognised keyword "\mathr"

    Unrecognised keyword "\ma"

    FXTerminal::replaceStyledText: bad argument range.




  • Arthur Norman

    Arthur Norman - 2009-10-12

    I suspect that the (1+x+y+z)^20 expression is too big for the "fancy" mode display, and that something internal overflows in a clumsy manner and smashes. If you are going to display big things like this then "off fancy;" will stop Reduce trying to display it cleverly and may be more robust.  I will try AT SOME STAGE to look into where the overflow happens or see if I can make the behaviour softer but not this week!

    Re the case of an exclamation mark at the end of a line or an otherwise missing semicolon to terminate an input statement, inspiration for a neat resolution has not yet struck me. It counts as bad user input and my bet is that whatever we do SOME ingenious bad user input will lead to confusion. Maybe somebody else can suggest something. Arthur

  • James

    James - 2009-10-13

    I see that, yes, both running as "reduce -w", or as "reduce" with "off fancy;" will avoid the problem displaying the output.  The most interesting thing to me, though, is that on my old 1.3GHz Athlon, the output from "(1+x+y+z)^20;" is almost instantaneous without the typeset display.  The typeset display otherwise takes about six seconds to format!

    BTW, I didn't know about "off fancy", which is not mentioned in Hearn's Version 3.8 Reduce User's Manual.  Is there some Reduce command which will simply dump all the available commands?



Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks