My data does not contradict Skip Cave's data, but they refute his conclusion: 
"The closed form solution is slow AND uses lots of space". Actually the closed 
form solution is fast and uses less space. 


   closed =: [: (,.3r4*<:) 5&^ NB. closed form verb definition
   closed 15x NB. test
30517578125 22888183593
   6!:2'closed 5000x' NB. timing
0.0181154
   6!:2'closed 5000x' NB. timing
0.0360412
   6!:2'closed 5000x' NB. timing
0.0292909
   6!:2'closed 5000x' NB. timing
0.0266407
   6!:2'closed 5000x' NB. timing
0.0186728

   closed 50 NB. using standard arithmetic
8.88178e34 6.66134e34


   6!:2'closed 50' NB. timing
0.000110246

- Bo


Fra:Boyko Bantchev <boyk...@gmail.com>

Til: programm...@jsoftware.com 
>Sendt: 14:52 søndag den 23. december 2012
>Emne: Re: [Jprogramming] arithmetic sequence
> 
>On 23 December 2012 02:59, Bo Jacoby <bojac...@yahoo.dk> wrote:
>
>> Note that the closed form solution doesn't have to compute the intermediate 
>> values.
>> ....................
>> Here the closed form solution was 14 times faster and used 29 per cent less 
>> space.
>
>Bo,
>
>You are comparing here two solutions for computing S(5000).
>What Skip was discussing was computing S(i) for i=1,…,5000.
>These are different problems, so your data does not contradict his.
>----------------------------------------------------------------------
>For information about J forums see http://www.jsoftware.com/forums.htm
>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to