> p1:= 3*x*y*x*z --> 3 x y x z
> lquo(p1,3*x*y) --> 9 x z (expected: x z)
Obviously, the coefficients are not taken into account. Even worse, they
are multiplied.
The docs speaks about "simplification".
> -- Cat XFreeAlgebra (xpoly.spad, L28)
> -- lquo : (%, %) -> %
> -- ++ \spad{lquo(x, y)} returns the left simplification of \spad{x} by
> \spad{y}.
Now it is a question how "simplification" actually is defined. :-(
Kurt, now you have to do some detective work to find out where those
lquo and rquo are actually used. I hope nowhere in the library.
To fix it, one must take into account that the domain parameter R is
only of type Ring.
Ralf
--
Waldek Hebisch
On Sun, Apr 06, 2025 at 06:38:32PM +0200, Waldek Hebisch wrote:
> On Sun, Apr 06, 2025 at 07:11:03AM -0700, Kurt Pagani wrote:
> > Either my understanding of lquo/rquo (Category XFreeAlgebra) is wrong or
> > there is a bug in the implementation of these functions in
> > XDistributedPolynomial (XDPOLY).
> >
> > p1:= 3*x*y*x*z --> 3 x y x z
> > lquo(p1,3*x*y) --> 9 x z (expected: x z)
> >
> > I think that by "left simplification" is meant mult by a left
> > inverse/recip, similiar as in group theory, although there is no leftRecip
> > of 3*x*y in XDPOLY, of course. Am I off the track?
>
> Current definition of 'lquo' looks odd, I have noticed this some
> time ago. OTOH there are some odd looking operations on XFreeAlgebra-s
> which actually make a lot of sense. So, it requires some investigative
> work to decide if this is a bug or an unfortunate name of operation
> needed elsewhere.
A little update: this does not look like a bug, there are two different
implementations in 'xpoly.spad' and similar implementation in
'xlpoly.spad'. There are also similar implementations of 'rquo'.
I do not know why 'lquo' and 'rquo' are defined in this way. One
possible explanation could be that in Lie case there are multiple
possibilities for "base" words and maybe the definition tries do
do something for words expressed in different basis.
AFAICS strange definitions of 'lquo' and 'rquo' are not used by
other code, so in principle we could remove them the reduce
confusion.
--
Waldek Hebisch
On Sun, Apr 06, 2025 at 11:54:52AM -0700, Kurt Pagani wrote:
>
> I can use factor from XPFACT in the meantime ... which seems to work for my
> purpose.
> (6) -> factor (3*x*y-3*x*z)$XPFACT(Symbol,EXPR INT)
>
> (6) [- 3 x, - y + z]
> Type:
> List(XDistributedPolynomial(Symbol,Expression(Integer)))
'xpfact.spad' also contains 'ldivide':
ldivide : (XDP, XDP) -> d_rec
++ ldivide(a, b) returns [c, r] such that a = b*c + r, r is
++ is of minimal possible degree and homogeneous part of
++ of r of maximal degree contains no terms divisible from
++ left by leading term of b.
When a is divisible by b, then r is 0 and c gives left quotient.
In general c is analogous to quotient from euclidean division.
If quotient alone seems useful, we could export it. We could also
add right versions of related operatons.
--
Waldek Hebisch
On Mon, Apr 07, 2025 at 08:45:26AM -0700, Kurt Pagani wrote:
>
>
> On Monday, 7 April 2025 at 16:06:42 UTC+2 Waldek Hebisch wrote:
>
> On Sun, Apr 06, 2025 at 06:38:32PM +0200, Waldek Hebisch wrote:
> > On Sun, Apr 06, 2025 at 07:11:03AM -0700, Kurt Pagani wrote:
>
>
> Yes, as long as there is no reasonable definition I would advocate for
> removal.
What about:
lquo : (%, %) -> %
++ \spad{lquo(x, y)} is a bilinear extention of \spad{lquo} from
++ words to \spad{%}.
--
Waldek Hebisch