|
From: Stavros M. <mac...@al...> - 2022-07-31 22:31:13
|
What is the motivation for these functions? Is it to make life easier for
beginners? I think it's a false simplicity. All in all, I think it's
generally better for users who want to manipulate expressions
programmatically to stick with *inflag=true*, for exactly the reasons that
Maxima uses its internal representation: simplicity and consistency. *part* is
good for interactive use, but a mess for programmatic manipulation.
Details:
- You also need *quotientp *and (unary) *minusp *(assuming you're not
binding *inflag* to *true*)
- What do you want *minusp* to do for negative numbers? They are
*mapatom*s, but have part/0 = "-" (but part/0 is an error with
*inflag=true*)
- What do you want *quotientp* to do for rational numbers? They are
*mapatom*s, but have part/0 = "/" (regardless of *inflag*).
- If you really want to be consistent with *part* (which is arguably
helpful for naive users):
- you'll also need *sqrtp *(unless you bind *sqrtdispflag* to *false*
)
- Note that even with *inpart=false*, *part *is not fully consistent
with the displayed form: *op(a-b)* is "+", not "-"
- Oh, and the order of *args(x-y) *depends on *negsumdispflag*.
- Users still need to understand *mapatom* for cases like
*op(ex)='sin*
- The functions' behavior depends on the global setting of *inflag *and
*%edispflag *-- is that your intent?
- They modify the global value of *piece *-- that means that mixing them
with *part* is problematic
-s
On Sun, Jul 31, 2022 at 2:32 PM Barton Willis via Maxima-discuss <
max...@li...> wrote:
> Would these functions be worthy additions to /src?
>
>
>
> (defmfun $timesp (x) (and (not ($mapatom x)) (equal ($part x 0) "*")))
>
>
>
> (defmfun $plusp (x) (and (not ($mapatom x)) (equal ($part x 0) "+")))
>
>
>
> (defmfun $exptp (x) (and (not ($mapatom x)) (equal ($part x 0) "^")))
>
>
>
>
>
> Or should they be defined differently? I think we’ve talked about this
> before.
>
>
>
> Instead of ($part x 0), we could call mpart.
>
>
>
> --Barton
>
>
>
>
>
>
>
>
> _______________________________________________
> Maxima-discuss mailing list
> Max...@li...
> https://lists.sourceforge.net/lists/listinfo/maxima-discuss
>
|