On Apr 29, 1:28 pm, RHui...@[EMAIL PROTECTED]
wrote:
> A solution to problem 2 in J.
>
> combsum=: 4 : 0 M.
> if. (x>:y)+.0=x do. ,: 1 ,~ +/"1 i.(x<:y),x
> else. (~.@[EMAIL PROTECTED]
,. +//.)/ |: (((x-1),0)+"1 x combsum&<: y),(x,0)+"1 x
> combsum y-1 end.
> )
>
> 6!:2 't=. 6 0 (+"1) 6 combsum 49'
> 0.0252536
>
> That is, 0.025 seconds.
>
> $t
> 259 2
> 3{.t
> 21 1
> 22 1
> 23 2
> _3{.t
> 277 2
> 278 1
> 279 1
>
> Details inhttp://www.jsoftware.com/jwiki/Essays/Combination_Sums
>
> On Apr 23, 10:51 pm, AAsk <AA2e...@[EMAIL PROTECTED]
> wrote:
>
> > It would be interesting to read a detailed account of what swayed the
> > Matlab fellow. Perhaps a book on APL and advanced mathematics is
> > needed.
>
> > A while ago,
>
> > 1. I was exploring the shortest path problem using APL: I wanted to
> > list all the paths. The shortest path is easily given by APL, see
> > Learning & Applying APL by B Legrand. No APL text book delved into
> > this area ie. enumerate all the paths. Google highlighted several non-
> > APL solutions. Eventually I found an APL solution written by a US
> > academic (can't remember the URL).
>
> > 2. A colleague was doing an investifation. Take the UK national
> > lottery - it has 6!49 combinations where the first (1,2,3,4,5,6) and
> > the last (44,45,46,47,48,49) have each got a sum and the number of
> > combinations that have the same respective sum is exactly 1. The
> > objective was to list each sum between the 2 with the number of
> > combinations ... quickly. After a lot of experimentation, the solution
> > ran in less than 2 minutes on a 1.6 GHz Pentium processor.
>
> > I've heard that APL had something to do with the planning of the
> > (glass) roof of the British Library but not read about it.
>
> > More in print on the undeniable case for APL would be very welcome.
> > Would it not?
Wow.


|
26 Posts in Topic:
|
vess_irvine@[EMAIL PROTEC |
2008-04-22 16:22:58 |
|
Morten Kromberg <mkrom |
2008-04-23 01:00:41 |
|
llund <lorin.lund@[EMA |
2008-04-23 10:59:34 |
|
jgrudd@[EMAIL PROTECTED]
|
2008-04-23 22:30:29 |
|
"David Liebtag" |
2008-04-24 16:12:37 |
|
Bob Cain <arcane@[EMAI |
2008-04-26 01:32:56 |
|
Olivier Lefevre <lefev |
2008-04-25 15:34:35 |
|
AAsk <AA2e72E@[EMAIL P |
2008-04-23 22:51:25 |
|
Jack <jgrudd@[EMAIL PR |
2008-04-23 23:32:25 |
|
"jk" <*axy*@ |
2008-04-24 09:02:16 |
|
"Stephen Taylor < |
2008-04-24 00:50:25 |
|
Jack <jgrudd@[EMAIL PR |
2008-04-24 23:33:31 |
|
"jk" <*axy*@ |
2008-04-25 09:17:17 |
|
"jk" <*axy*@ |
2008-04-25 12:06:34 |
|
"jk" <aqxqy@ |
2008-04-25 22:46:01 |
|
Jack <jgrudd@[EMAIL PR |
2008-04-24 23:55:17 |
|
Jack <jgrudd@[EMAIL PR |
2008-04-25 18:29:15 |
|
"jk" <aqxqy@ |
2008-04-26 08:41:59 |
|
Jack <jgrudd@[EMAIL PR |
2008-04-26 19:36:17 |
|
"jk" <aqxqy@ |
2008-04-27 08:51:30 |
|
Jack <jgrudd@[EMAIL PR |
2008-04-28 23:10:00 |
|
RHui000@[EMAIL PROTECTED] |
2008-04-29 12:28:43 |
|
vess_irvine@[EMAIL PROTEC |
2008-04-30 19:37:41 |
|
Jack <jgrudd@[EMAIL PR |
2008-04-30 20:50:55 |
|
Steve <steve@[EMAIL PR |
2008-05-01 19:24:17 |
|
"jk" <aqxqy@ |
2008-05-02 09:25:35 |
|