Carlo Carminati

35 Reputation

6 Badges

13 years, 19 days
Universita' di Pisa
Dr.

I am a researcher working in Pisa.

In a nutshell, I am interested in dyanamical systems, ergodic theory and number theory (expecially issues connected with continued fractions).

I am using Maple (mostly in a naive way :) to investigate some combinatorial issues arising from my research.

MaplePrimes Activity


These are answers submitted by Carlo Carminati

@roman_pearce

Thanks! I did not know this funny TABLE procedure: it seems powerful (even if it has some akward  features - I prefer lists!).

In principle, you are right, but the problem is that what I am interested in is actually a bisection algorithm, so in any case I have to re-index all elements (I want to keeb them ordered), and I am not sure it will really be much faster (I will try). [Update: now I have tried, it is really much faster!]

Anyway the script should work like this:

############### toy model : bisections of [0,1]  ##############

L:=table([0, 1]);

bisection:=proc(LL);
#n:=nops([indices(LL)]);
n:=nops(op(op(LL)));  ###  #
table([seq((2*j-1)=LL[j], j=1..n), seq((2*j)=(LL[j]+LL[j+1])/2, j=1..n-1) ]);
end;
bisection(L);
for j from 1 to 5 do
L:=bisection(L);
od:
LIST:=[seq( L[j], j=1..nops([indices(L)]) )];

###################################################

one question: it is quite strange to use a command like
n:=nops(op(op(LL)));
to evaluate the numbers of items in a table. Is there something more canonical?

Page 1 of 1