On 6/15/26 9:58 AM, Waldek Hebisch wrote:
>>
>> We can leave smaller?$EXPR aside for now.
>>
>> In Kernel:
>>
>> triage(k1, k2) ==
>>   height(k1)   ~= height(k2)   => B2Z(height(k1)   < height(k2))
>>   operator(k1) ~= operator(k2) => B2Z(operator(k1) < operator(k2))
>>   (n1 := #(argument k1)) ~= (n2 := #(argument k2)) => B2Z(n1 < n2)
>>   for x1 in argument(k1) for x2 in argument(k2) repeat
>>     x1 ~= x2 => return B2Z(smaller?(x1, x2))
>>   0
>>
>>
>> There is already a check that x1~=x2.
>> So in this case, it's perfectly fine to use the method above
>> to determine order?
> 
> Probably.  OTOH it looks to me that 'x1 ~= x2' already did all
> expensive things needed for 'smaller?'.  So replacing both
> by their definitions and reusing subexpressions should be
> as fast as what you propose.
> 

That can be done, preserve the old behavior, doesn't break
anything and saves memory.


However for the new approach:

I looked over the differences of "make all" in src/input
before and after this change.

Most changes are display order change.

Other changes seems to be correct, and simpler.
(Most happens in mapleok.input and rsimp.input.)

I haven't checked out the reason behind this.

One thought: we need a test suite that has more coverage.


Current smaller? does this:
compares numer(x)*denom(y) with numer(y)*denom(x)

This doesn't make much sense.  The "smaller?" seems to
do comparison with the complexity of expression.
And the cross multiplication doesn't "preserve" complexity.

At least my proposed version is doing comparison
lexicographical.

Another point of view: the comparison in Kernel
is doing field by field comparison, consider expr
as "a/b", with "/" being operator, then doing field by field
comparison on "b", then "a".

Anyway, this change is very disruptive.  More thought and
testing should go with it.

- Qian

-- 
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 visit 
https://groups.google.com/d/msgid/fricas-devel/5a840b85-fd3b-4bce-a1f8-9eb363d69c37%40gmail.com.

Reply via email to