rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

No SIMP function #1553

Closed rtoy closed 2 days ago

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:38:01 Created by macrakis on 2003-04-11 22:36:06 Original: https://sourceforge.net/p/maxima/bugs/298


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.

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:38:02 Created by robert_dodier on 2006-07-06 06:01:07 Original: https://sourceforge.net/p/maxima/bugs/298/#8688


rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:38:06 Created by robert_dodier on 2006-08-27 00:24:11 Original: https://sourceforge.net/p/maxima/bugs/298/#96f4


rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:38:09 Created by macrakis on 2006-08-28 14:48:16 Original: https://sourceforge.net/p/maxima/bugs/298/#1fa0


Logged In: YES user_id=588346

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

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.

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:38:13 Created by robert_dodier on 2006-08-29 14:34:43 Original: https://sourceforge.net/p/maxima/bugs/298/#7cbd


Logged In: YES user_id=501686

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

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:38:16 Created by macrakis on 2006-08-29 14:58:52 Original: https://sourceforge.net/p/maxima/bugs/298/#8921


Logged In: YES user_id=588346

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) rex:rat(ex)$ logexpand:all$ 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)

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:38:20 Created by crategus on 2010-02-17 18:53:39 Original: https://sourceforge.net/p/maxima/bugs/298/#0678


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

rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:38:23 Created by crategus on 2010-02-21 14:26:04 Original: https://sourceforge.net/p/maxima/bugs/298/#f4a9


rtoy commented 2 days ago

Imported from SourceForge on 2024-07-04 19:38:27 Created by crategus on 2010-02-21 14:26:04 Original: https://sourceforge.net/p/maxima/bugs/298/#b502


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