Adam Majewski a ?crit :
> ......reyssat pisze:
>> This is the first method of
>> http://magma.maths.usyd.edu.au/magma/Examples/node6.html
>> a maxima implementation is :
>> fc(n):=block(a:0,b:1,c:1,d:n,
>> while c<n do
>> (k:floor ((b+n)/d), e:k*c-a,f:k*d-b, a:c,b:d,c:e,d:f));
>
> Thx but fc gives no result. (:-))
Yes, this is why I said the elements are computed but not stored.
One way to get a result is to add a print instruction inside the loop :
(k:floor ((b+n)/d), e:k*c-a,f:k*d-b, a:c,b:d,c:e,d:f, print([a,b])));
Of course, printing takes time.
An other way is to store the result, maybe by appending the new element :
fc(n):=block(L:[],a:0,b:1,c:1,d:n,
while c<n do
(k:floor ((b+n)/d), e:k*c-a,f:k*d-b, a:c,b:d,c:e,d:f,
L:append(L,[[a,b]])),L);
but I don't know if appending one element each time is efficient or not.
Eric
>
> Adam
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>