[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## [Axiom-math] Re: [Axiom-mail] Lexicographic order

**From**: |
Jens Axel Søgaard |

**Subject**: |
[Axiom-math] Re: [Axiom-mail] Lexicographic order |

**Date**: |
Mon, 29 Aug 2005 19:34:10 +0200 |

**User-agent**: |
Mozilla Thunderbird 1.0.2 (Windows/20050317) |

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