[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-math] Re: [open-axiom-devel] missing exports in Finite DirectProd
From: |
Francois Maltey |
Subject: |
[Axiom-math] Re: [open-axiom-devel] missing exports in Finite DirectProduct and Product |
Date: |
18 Oct 2007 15:30:06 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
Dear Bill, and others.
About Product (i.e. cartesian product) and DirectProduct over finite domains.
You add 'index', 'lookup', and 'hash'.
> The operation 'size' is already available as a default.
> Having 'index' available for products allows one to iterate over the
> elements of a cross product like this:
>
> X:=Product(OVAR [a,b],IntegerMod(3))
> [index(i::PI)$X for i in 1..size()$X]
Right, axiom searchs for the congruent integer with index and lookup.
But is it possible to have an intrinsic loop than an integer loop ?
Dom := OVAR [aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll]
[i for i in dd..ee]
> Writing this made me think that it was also desirable the domains in
> Finite also enumerate there members in a more functional manner so
> because FriCAS now allows us to easily make fairly deep changes in the
> algebra code, as an exercise I decided to define the following new
> export of Finite
>
> expand: () -> List %
> expand() == [index(i::PositiveInteger) for i in 1..size()]
A good primitive. The expand name looks as expand (100..110).
For finite domains you enumerate all the cases, not a subset of cases.
I don't find any expand functions in others finite domain.
Others systems uses expand for expanding calculus only.
So I prefer an enumerate function to an expand function,
and add an enumerate in all the finite structure
address@hidden,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll] responds
[aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll]
So I see 2 functions :
enumerate without arguments for all the cases.
and expand with a interval for subset.
Is it possible to get this after an expand (5..7, aa..cc) ?
[[5,aa],[6,aa],[7,aa],[5,bb],[6,bb],[7,bb],[5,cc],[6,cc],[7,cc]]
I don't see how to type this expand.
> So with this patch one can write for example:
>
> (1) -> map(x+->(selectsecond(x)::Symbol)^(selectfirst(x)::Integer), _
> expand()$Product(ZMOD(3),OVAR [a,b]))
> 2 2
> (1) [a,b,a ,b ,1,1]
It's a progress to allow this map, but it isn't too serviceable.
Why not a
map (x +-> x.1::Symbol^x.2::Integer
for x in enumerate()$Product(ZMOD(3),OVAR [a,b]))
map (x +-> x.1::Symbol^x.2::Integer
for x in expand(1..2,a..b)$Product(ZMOD(3),OVAR [a,b]))
So axiom has record and cartesian products,
but the must use of makeprod(,)@... or news(,)@.... isn't friendly.
Mathematics use so often cartesian product it's penalizing to
have to declare a cartesian product with new or makeprod.
Other languages allow lists for this uses because they aren't typed.
A new constructor as [|...,...|] should be a great progress in the
interface. By example caml uses [1;2;3] for lists and [|1;2;3|] for array.
> I would be interested in your opinions about this approach to
> providing Cartesian products for the Axiom library.
A really good idea for finite domains.
> I think it is interesting to see how domains in the category Finite
> able to participate like "sets" in the language.
What are the commom functions in this cases ?
index, lookup, hash, are they present in all finite domains ?
Enumerate in a list all the elements is a good idea.
It may be interesting to expand? a sub-interval.
For cartesian product in general a short constructor will be a
serious avantage. output [|n, (X-1)^n|] will work.
> Of course Aldor already has implemented some basic abstractions of
> this kind but it is not entirely obvious to me how best to extend
> Axiom's library and still stay within the limitations of the current
> Spad language.
Will axiom interpreter include aldor or not in the future ?
F.