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: Mon, 29 Aug 2005 12:50:32 -0500

Changes http://page.axiom-developer.org/zope/mathaction/AxiomMail/diff
--
Hi Martin,

 > Although I'm not 100% sure what lexorder? ought to do exactly, you
 > might want to notice the following:
 >
 > the first matching type the interpreter finds for [x,y,z] is
 >
 > (13) -> [x,y,z]
 >
 >    (13)  [x,y,z]
 >                                        Type: List OrderedVariableList 
[x,y,z]
 >
 > which means that in sort([x,z,y]) you are using the order imposed by
 > OrderedVariableList [x,y,z], which is z < y < x.

Ah!

 > If you say
 >
 > sort([x,z,y]::List Symbol), you will get the expected output.

That worked.

 > I'm not totally sure how you can find out what ordering a domain uses.
 > But very likely, if its name doesn't contain something like "Ordered",
 > it is the usual lexicographic order.

Part of my problem was that I had to polynomials, which might be belong
to polynomial rings over different variables. I am probably not going
to use lexorder?, I am just trying to get used to the Axiom way of
doing things. Fortunately it feels very Lispy to me (if it weren't for 
the fact that tail recursion wasn't supported, I'd had said Schemy).

Lexorder examines the difference of exponent vectors of the multivariate
polynomials p and q. If the leftmost non-zero entry is positive, then p>q.

lexorder?(p,q) ==
   if  empty?(variables(p))
   then return ~empty?(variables(q))
   else
     vars := sort(members(union(set(variables(p)),
                                set(variables(q))))::List Symbol)
     a := vector(members(degree( p::DMP(vars,?) )))
     b := vector(members(degree( q::DMP(vars,?) )))
     n := select( x +-> ~zero?(x), members(a-b))
     if empty?(n)
     then return false
     else return positive?(first(n))

-- 
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]