Open rtoy opened 3 months ago
Imported from SourceForge on 2024-07-06 10:05:48 Created by robert_dodier on 2022-02-21 07:38:01 Original: https://sourceforge.net/p/maxima/bugs/3944/#d5b5
Looking at the code (SIMPNCEXPT in src/mdot.lisp), I see that behavior is governed by SIMPNCT-SC-OR-CONSTP in lines 280--281. A constant factor is pulled out if dotconstrules
is nonnull, and a scalar factor is pulled out if dotscrules
is nonnull; see SIMPNCT-CONSTANTP and SIMPNCT-ASSUMESCALARP, respectively.
The default value of dotconstrules
is true
, so literal or declared constants are pulled out. The default value of dotscrules
is false
, so scalars are not pulled out. However, changing to the other value (false
or true
) changes the behavior as expected. Also, assumescalar: all
causes undeclared symbols to be treated as scalars, as expected.
At this point I think the code is working as expected, and it's just a matter of mentioning ^^
in the documentation for dotconstrules
, dotscrules
, and assumescalar
. Likewise those flags should be mentioned in the documentation for ^^
.
Imported from SourceForge on 2024-07-06 10:05:52 Created by robert_dodier on 2022-02-21 07:38:59 Original: https://sourceforge.net/p/maxima/bugs/3944/#6f84
Imported from SourceForge on 2024-07-06 10:05:55 Created by macrakis on 2022-02-21 13:52:18 Original: https://sourceforge.net/p/maxima/bugs/3944/#cfdd
Thanks for looking in to this. Indeed, dotscrules:true$ assumescalar:all
takes care of this case. However, according to the documentation of assumescalar
, an undeclared symbol which is an argument to a commutative operator like *
is assumed scalar, so this should work:
declare(A,nonscalar)$
dotscrules:true$
(q*A)^^-1 => (A*q)^^-1 <<< ???
Although the doc for assumescalar
only mentions explicit lists and matrices, not symbols declared nonscalar
as the other argument, the fact that it works in the all
case suggests that it should work in the true
case as well.
PS I had actually tested all the dotxxx variables... though not assumescalar
.
Imported from SourceForge on 2024-07-06 10:05:47 Created by macrakis on 2022-02-20 15:01:25 Original: https://sourceforge.net/p/maxima/bugs/3944
Contrast
I thought that the problem is that detout returns a pseudo-simplified (non-canonically simplified) expression. But in fact this happens even with correctly simplified expressions:
but
I don't believe this behavior is controlled by a **dot**xxx setting, but I may be mistaken.
Maxima 5.45.1 SBCL 2.0.0 Windows