Hello my friends

A program for polynomial extrapolation can be written

   etc=.{.&.:(t :.t=.[: {."1 (2-/\])^:([: i. #))

For example, the first 21 square numbers are extrapolated from 3 square numbers 
like this.

   21 etc 0 1 4
0 1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 289 324 361 400

My first question is this: Can the program be written without naming the 
intermediate verb (t) ?

Note that t is an involution:
   t t 0 1 4
0 1 4
and the etc program just pads zeroes
   21 {. t 0 1 4
0 _1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
before transforming back.
   t 21 {. t 0 1 4
0 1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 256 289 324 361 400

The transformation (t) creates a space-consuming intermediate matrix 
   (2-/\])^:([: i. #) 1 4 9
 1  4 9
_3 _5 0
 2  0 0
where only the first row is input and only the first column is output. I want 
to compute in-place to save space:
   1, 4 9 --> 1 _3, _5 --> 1 _3 2
My second question: How is that done?

Venlig hilsen, Bo




----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to