[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-mail] Lexicographic order
From: |
Jens Axel Søgaard |
Subject: |
[Axiom-mail] Lexicographic order |
Date: |
Mon, 29 Aug 2005 00:14:09 +0200 |
User-agent: |
Mozilla Thunderbird 1.0.2 (Windows/20050317) |
Hi all,
Is there a smarter way than the following to write lexorder?(p,q) ?
lexorder?(p,q) ==
if empty?(variables(p))
then return ~empty(variables(q))
else
vars := members(difference( set(variables( secret1*p + secret2*q)),
set([secret1, secret2])))
a := members(degree( p::DMP(vars,?) ))
b := members(degree( q::DMP(vars,?) ))
return negative?( first(a) - first(b) )
My first attempt used:
vars := sort(members(union(set(variables(p), variables(q)))))
but was surprised to see
> sort([x,y,z])
[z,y,x]
> sort([x,z,y])
[y,z,x]
and thus made up the secret-trick in order to avoid sort.
--
Jens Axel Søgaard
- [Axiom-mail] Lexicographic order,
Jens Axel Søgaard <=