axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] [Axiom-mail] Lexicographic order


From: Jens Axel Søgaard
Subject: [Axiom-developer] [Axiom-mail] Lexicographic order
Date: Sun, 28 Aug 2005 17:48:47 -0500

Changes http://page.axiom-developer.org/zope/mathaction/AxiomMail/diff
--
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 mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/axiom-mail

--
forwarded from http://page.axiom-developer.org/zope/mathaction/address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]