#298 No SIMP function

Stavros Macrakis

The info file documents a function SIMP, which "causes
exp to be simplified regardless of the setting of the
switch SIMP which inhibits simplification if FALSE".
But there is no such function defined.

It is also not clear if this is supposed to force
resimplification of the whole expression, or only the part
without SIMP flags.


  • Robert Dodier
    Robert Dodier

    Logged In: YES

    The description of the simp function went away some months
    ago (late 2004, I think). So the documentation of a
    nonexistent function is no longer a problem.

    It makes me wonder, though, if we to expose SIMPLIFYA
    somehow or something like that. If the answer is "no",
    let's close this bug report.

  • Robert Dodier
    Robert Dodier

    • labels: --> 460522
  • Robert Dodier
    Robert Dodier

    • labels: 460522 --> Lisp Core - Simplification
  • Logged In: YES

    Robert, you suggest that we expose Simplifya. But Simplifya
    is called automatically by meval every time you evaluate

    You might think it was useful when simp=false. But when
    simp=false, it has no effect.

    I think what you want is a "resimplify" function, which
    would resimplify all subparts of an expression with current
    settings. As I've mentioned in email before, this already
    exists, though admittedly in a very obscure form:
    expand(...,0,0). It would be reasonable to have a
    user-friendly name for it, e.g. resimplify.

  • Robert Dodier
    Robert Dodier

    Logged In: YES

    There exists a Lisp function RESIMPLIFY -- How does
    expand(foo, 0, 0) differ from ?resimplify(foo) ?

  • Logged In: YES

    expand(...,0,0) calls ?resimplify. The difference is that
    expand does a specrepcheck. Since almost no simplification
    flags apply to specreps, it is probably appropriate to do
    the specrepcheck. You could argue that if the input is in
    CRE form, you should just re-rat it to get the effect of
    changed keepfloat, ratfac, etc. flags, but I think that's
    too complicated; and you can always call rat to re-rat.

    ex:log(a*b) => log(a b)
    ex => log(a b)
    rex => /R/ log(a b)
    expand(ex) => log(b) + log(a)
    ?resimplify(ex) => log(b) + log(a)
    expand(rex) => log(b) + log(a)
    ?resimplify(rex) => /R/ log(a b)

  • Dieter Kaiser
    Dieter Kaiser

    Again an example to show the possibilities we have:

    We set the variable y and x.

    (%i1) y:sin(x); x:1;
    (%o1) sin(x)
    (%o2) 1

    We change the environment:

    (%i3) exponentialize:true;
    (%o3) true

    These are three possibilities to resimplify sin(x) without evaluation (the value of x is not inserted):

    (%i4) expand(y,0,0);
    (%o4) -%i*(%e^(%i*x)-%e^-(%i*x))/2

    (%i5) ev(y,noeval);
    (%o5) -%i*(%e^(%i*x)-%e^-(%i*x))/2

    (%i6) ?resimplify(y);
    (%o6) -%i*(%e^(%i*x)-%e^-(%i*x))/2

    These three possibilities behave differently when we have a CRE expression.

    (%i13) exponentialize:false$

    (%i12) r:rat(2*sin(x));
    (%o12)/R/ 2 sin(x)

    (%i13) exponentialize:true$

    The function expand does a specrepcheck. The result is no longer a CRE expression:

    (%i14) expand(r,0,0);
    (%o14) -%i*(%e^(%i*x)-%e^-(%i*x))

    The function ev simplifies and returns a CRE expression:

    (%i15) ev(r,noeval);
    (%o15)/R/ -(%i*(%e^(%i*x))^2-%i)/%e^(%i*x)

    The Lisp function resimplify does nothing for a CRE expression:

    (%i16) ?resimplify(r);
    (%o16)/R/ 2 sin(x)

    The possibility to resimplify with ev(expr,noeval) is part of the documentation of the function ev.

    I would like to suggest to add a comment to the function expand that expand(expr,0,0) allows the resimplification of an expression and to close this bug report.

    Dieter Kaiser

  • Dieter Kaiser
    Dieter Kaiser

    A comment about the possibility to resimplify an expression with the command expand(expr,0,0) has been added to Simplifications.texi revision 1.25. The possibility to resimplify with the command ev(expr,noeval) is already documented.

    In addition and if it is desired we might support a user function resimplify which does expand(expr,0,0) in a more user friendly way.

    Setting the status to pending and the resolution to "works for me".
    Dieter Kaiser

  • Dieter Kaiser
    Dieter Kaiser

    • status: open --> pending
    • status: pending --> closed
  • This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).