> Yes, but different ways give different insights.  See:
> http://www.jsoftware.com/jwiki/Essays/Pascal's_Triangle

For example, the n-th set of binomial coefficients are seen
as the polynomial coefficients of the function (x+1)^n :

   (>: ^ 9:) t. i.10
1 9 36 84 126 126 84 36 9 1
   (i.10)!9
1 9 36 84 126 126 84 36 9 1

Therefore the (2*n)-th set of binomial coefficients are
the polynomial coefficients of (x+1)^(2*n), and the
latter obtain efficiently by repeated polynomial squaring:

   polytimes=: +//.@(*/)

   ((i.65)!64x) -: polytimes~^:6 ] 1 1x
1
   10 timer '(i.65)!64x'
0.00483466
   10 timer 'polytimes~^:6 ] 1 1x'
0.00187677



----- Original Message -----
From: Roger Hui <[email protected]>
Date: Monday, February 15, 2010 17:35
Subject: Re: [Jprogramming] Constant functions
To: Programming forum <[email protected]>

> Yes, but different ways give different insights.  See:
> http://www.jsoftware.com/jwiki/Essays/Pascal's_Triangle
> 
> As an exercise, see how many ways you can come
> up with to generate the identity matrix.
> http://www.jsoftware.com/jwiki/Essays/Identity_Matrix
> 
> 
> 
> ----- Original Message -----
> From: Alex Gian <[email protected]>
> Date: Monday, February 15, 2010 16:26
> Subject: Re: [Jprogramming] Constant functions
> To: Programming forum <[email protected]>
> 
> > On Mon, 2010-02-15 at 10:24 +0000, Ian Clark wrote:
> > 
> > > One can learn a lot of tacit J just by analysing that 
> > example:  bc=:
> > > < 0&(, + ,~) 1:
> > 
> > Can't pretend I understand much of it, but I intend to take it 
> > apart in
> > tonight's "Learning J" session!  Great to see all this stuff.
> > 
> > Now forgive me if I'm missing something in all this (as a 
> newb) but
> > wouldn't a simpler way of generating binomial coefficients 
> just be:
> > 
> >    !/~i.10
> > 
> > 1 1 1 1 1  1  1  1  1   1
> > 0 1 2 3 4  5  6  7  8   9
> > 0 0 1 3 6 10 15 21 28  36
> > 0 0 0 1 4 10 20 35 56  84
> > 0 0 0 0 1  5 15 35 70 126
> > 0 0 0 0 0  1  6 21 56 126
> > 0 0 0 0 0  0  1  7 28  84
> > 0 0 0 0 0  0  0  1  8  36
> > 0 0 0 0 0  0  0  0  1   9
> > 0 0 0 0 0  0  0  0  0   1
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to