[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-developer] Re: [open-axiom-devel] [fricas-devel] Re: iterators an
From: |
Martin Rubey |
Subject: |
[Axiom-developer] Re: [open-axiom-devel] [fricas-devel] Re: iterators and cartesian product. |
Date: |
22 Oct 2007 11:54:11 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
Francois Maltey <address@hidden> writes:
> Hello Martin,
>
> > > At use, Mupad is almost perfect
> > > [a $a=0..9] and [10*a+b $a=1..9$b=0..9] and [10*a+b $a=1..9$b=0..9$c=0..9]
> > > $ is a (right to left)? inner operator.
> > >
> > > Of corse parallel iterations must remain as a pretty pure concept of
> > > axiom.
> >
> > So, how do you do parallel iteration in MuPad?
>
> With a silly
>
> [...L[i]...LL[i]... for i in 1 .. min([4, length L, length LL])]
> vs the shorter [...x...xx... for x in L for xx in LL for k in 1..4] for
> axiom
OK, I don't like MuPad's syntax then :-)
>
>
> I like the possible new repeat operator :
>
> [matrix [[a,b,15-a-b],[c,d,15-c-d]] for a in 1..9 repeat for b in 1..9 repeat
> for c in 1..9 repeat for d in 1..9]
I don't. I'd rather stick to the way I express things as a mathematician,
i.e., (currently not working)
[matrix [[a,b,15-a-b],[c,d,15-c-d]] _
for (a,b,c,d) in CartesianProduct([1..9, 1..9, 1..9, 1..9])]
or, maybe
[((a,b,c,d) := e; matrix [[a,b,15-a-b],[c,d,15-c-d]]) _
for e in CartesianProduct([1..9, 1..9, 1..9, 1..9])]
In fact, it nearly works:
-------------------------------------------------------------------------------
(1) -> l := [[1,2], [3,4]]
(1) [[1,2],[3,4]]
Type: List List PositiveInteger
(2) -> [a,b] := first l
(2) [1,2]
Type: List PositiveInteger
(3) -> a
(3) 1
Type: PositiveInteger
(4) -> b
(4) 2
Type: PositiveInteger
(5) -> [([x,y] := e; matrix [[x,y],[y,x]]) for e in l]
Though x has declared type (or partial type) PositiveInteger it does
not have an assigned value. You must give it one before it can be
so used.
(5) -> x
(5) 1
Type: PositiveInteger
(6) -> y
(6) 2
Type: PositiveInteger
(7) -> [(x := first e; y := second e; matrix [[x,y],[y,x]]) for e in l]
+1 2+ +3 4+
(7) [| |,| |]
+2 1+ +4 3+
Type: List Matrix Integer
-------------------------------------------------------------------------------
> This command breaks this previous mathematical set
> but build Union_{for a} (Unioun_{for b} (Unioun_{for c} set matrix for d))
Hm, I do not understand this sentence at all. Which command breaks what?
Martin
[Axiom-developer] Re: [open-axiom-devel] [fricas-devel] Re: iterators, Ralf Hemmecke, 2007/10/21