axiom-mail
[Top][All Lists]
Advanced

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

Re: [Axiom-mail] Doubt about IndexedExponents


From: Gabriel Pires
Subject: Re: [Axiom-mail] Doubt about IndexedExponents
Date: Mon, 11 Apr 2011 23:14:20 -0300

Thank you again!

Yeah, I didn't mean to send a private mail, my intention was to send a reply to the list, but I must have clicked somewhere stupid on my gmail.

That sure helped me a lot, now I suppose I understand how IndexedElements work and can use it with my mind at ease!

Thanks,

Gabriel,

On Mon, Apr 11, 2011 at 8:12 PM, Ralf Hemmecke <address@hidden> wrote:
Are you sure you wanted to send a private email? I very much prefer if the discussion stays public.

So, I used Axiom

As you have certainly realized, I'm a user/developer of FriCAS, a fork of Axiom. But all I'm saying probably also applies to Axiom. But if I point you to code, I'll point you to FriCAS code, simply, because I am more familiar with it than with the Axiom code base.


to try to manipulate some objects in an
AbelianOrderedMonoidSup, but I can't seem to find a way. Let me show you my
steps (they don't differ from OP, but anyways):

ls : List Symbol := [x]
V := OVAR(ls)
E := IndexedExponents(V)

Let's first look into the code.

The implementation of IndexedExponents inherits most of its implementation from IndexedDirectProductOrderedAbelianMonoidSup.

https://github.com/hemmecke/fricas-svn/blob/master/src/algebra/multpoly.spad.pamphlet#L820

This inherits from IndexedDirectProductOrderedAbelianMonoid.

https://github.com/hemmecke/fricas-svn/blob/master/src/algebra/indexedp.spad.pamphlet#L296

etc. I hope you know how to use grep. It's a bit tedious, but you can learn a lot from the code.

OK, you probably want a simpler method. Take hyperdoc browse and enter IndexedExponents. Click on Constructors. Then click Operations -> Signatures.
Or simply type

 )show E

after you have defined E like above.

Now, as I said in my last mail about "Abelian", the Monoid E is additively written. In hyperdoc you see +:(%,%)->%, but no *:(%,%)->%.

And sample:()->% is a function that returns an element of E. It is nowhere said that it returns a random element. So if it returns 1

Showing 1 is a bit misleading, since it rather behaves like zero.

(5) -> e:E :=sample()$E

  (5)  1
       Type: IndexedExponents(OrderedVariableList([x]))
(6) -> e+e

  (6)  1
       Type: IndexedExponents(OrderedVariableList([x]))


Ok, now, what I expect to see from what I learned is that E is a monoid of
powers of x, possibly with 1 being the "highest" term of the monoid.

I'd bet that 1 is rather the "lowest" term. That depends on how you read a<b.


And I can't use 'x' to make an object, or multiply by x, or multiply 1 by a
constant... can't seem to use or know what are the objects in the monoid...

If you just say

 x*e

that will of course not work. Why? Because, the x you give here is of type Symbol. Do you find a function *: (Symbol, %) -> % in the list from ")show E"? No. So x*e can only return an error.

How to construct the right x? Well, the x you are looking for is not the symbol x, but rather the monomial x^1 from E. And there is a function

 monomial : (NonNegativeInteger,OrderedVariableList([x])) -> %

The first argument is the power and the second is an element of V.
How to get an element of V? V has only 1 element, so lets

)show V
 OrderedVariableList([x]) is a domain constructor.
 Abbreviation for OrderedVariableList is OVAR
 This constructor is not exposed in this frame.
------------------------------- Operations --------------------------------

 ?<? : (%,%) -> Boolean                ?<=? : (%,%) -> Boolean
 ?=? : (%,%) -> Boolean                ?>? : (%,%) -> Boolean
 ?>=? : (%,%) -> Boolean               coerce : % -> OutputForm
 convert : % -> InputForm              convert : % -> Pattern(Float)
 convert : % -> Pattern(Integer)       convert : % -> Symbol
 enumerate : () -> List(%)             hash : % -> SingleInteger
 index : PositiveInteger -> %          latex : % -> String
 lookup : % -> PositiveInteger         max : (%,%) -> %
 min : (%,%) -> %                      random : () -> %
 size : () -> NonNegativeInteger       smaller? : (%,%) -> Boolean
 ?~=? : (%,%) -> Boolean
 variable : Symbol -> Union(%,"failed")

I'm sure you try

(7) -> v:V :=index 1

  (7)  x
                        Type: OrderedVariableList([x])

first. Voila, there is your x, now stored in the variable v. Oh, but it's of type V, not E!!!
OK, we use

(10) -> z: E := monomial(1,v)

  (10)  x
           Type: IndexedExponents(OrderedVariableList([x]))

and have the x we were looking for (stored in the variable z).
And now we can do monoid operations with this x.

(12) -> z+z

         2
  (12)  x
          Type: IndexedExponents(OrderedVariableList([x]))

(14) -> 3*z

         3
  (14)  x
           Type: IndexedExponents(OrderedVariableList([x]))

I know this additive structure written in a multiplicative form is a bit confusing, but that's the way it is currently. Some long time ago, wrote my own polynomial domain with the corresponding monoid written multiplicatively. But here you have to live with it until somebody comes and changes it to something better.

Does that help you?

Ralf

PS: If you like to reply, please do it on the mailing list. Other people might benefit from it. You have my permission to use the text from above.

PPS: You should also try to use a sandbox on the axiomwiki
http://axiom-wiki.newsynthesis.org/FrontPage
Just replace "FrontPage" with "SandboxYourFancyTitle" in order to create a new page.



reply via email to

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