Certainly not a problem for the definition of smaller?, as it just
wants a linear order, but for factorization I would have expected
that a polynomial with a smaller degree counts as smaller.
Well, SparseMultivariatePolynomial uses lexicographic order.No. That
is not true.S := SMP(Integer, Symbol);px := x::S;py := y::S;
smaller?(-py^100,px) -- returns true
smaller?( py^100,px) -- returns false
For Gröbner bases lex order just works on the exponent vectors and
doesn't care about the coefficient ring at all. Certainly not a total
order suitable for Comparable. A simpler probably cheaper total order
for SMP would be to just compare degree in the main variable and only if
that is equal apply smaller? to the leading coefficient (a polynomial in
one variable less). That also ends with calling smaller?(r1,r2) on the
base ring R, but most probably recusion is not so deep because the
polynomials differ in degree in the main variable.
Current answer to your wish for degree order is "use domain with
degree order like HomogeneousDistributedMultivariatePolynomial".
No, no. I never wished for something. Just my expectations were not met.
I must say that I am not fully satisfied with this answer, but
lexicographic order as _default_ order for
SparseMultivariatePolynomial makes a lot of sense.
Yes, of course. But what order are you talking about, the one given by
smaller? is maybe lexicographic, but not in the sense it is usually used
in Gröbner bases theory. POLYCAT-;smaller? implement an order that works
by virtually introducing 0-coefficients in order to bring both
polynomials to the same degree. Possible, but I have the feeling that it
is costly.
Including coefficients is necessary to have ordered ring. Note that
over fields our univariate factors are monic. Over integers we
normalize factors so that leading coefficient is positive. So in
both cases bigger degree will win.
I don't check now, but on this subset both implementations might give
the same result, but I still claim that the one that only recurses if
the degrees in the main variable are equal has less work to do.
adding exponents, multiplication is eqivalent to merge of sorted
lists with removal of duplicates.
Oh, now I see. You just perform multiplication in Factored, i.e., adding
exponents. No real multiplication of polynomials. I did not understand
this from your previous mails. OK, then ordering makes, of course, sense.
Ralf
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/8892c911-544d-51bb-0c0f-4d66ba559eb7%40hemmecke.org.