Newton polynomial p below is based on table au whose first row contains
coefficients, second row, special values of the argument.
]au =: a ,: u
0 1 4 1
0 1 3 6
p =: 3 : '+/ 0 1 4 1 * 1,(y-0),((y-0)*(y-1)),((y-0)*(y-1)*(y-3))'
----------------------------------------------------------------------
Can you write an adverb Np (Newton polynomial) such that verb au Np is
equivalent to the Newton polynomial specified in table au?
----------------------------------------------------------------------
Just so you know where the unused 6 came from, this polynomial was created to
fit the following data with not-equally-spaced argument values
]uv =: (] ,: ^&3) 0 1 3 6 NB. Table for "v = u^3"
0 1 3 6
0 1 27 216
and the 6 was needed to help find the coefficients in the first row of au above.
Polynomial p fits the data exactly,
(^&3 ,: p"0) 0 1 3 6
0 1 27 216
0 1 27 216
and with a little algebra you can show p is the same as 0 0 0 1&p. ,
(^&3 ,: 0 0 0 1&p.) 0 1 3 6
0 1 27 216
0 1 27 216
(For Newton polynomials, see
http://en.wikipedia.org/wiki/Newton_polynomial
and for divided difference tables see
http://en.wikipedia.org/wiki/Divided_differences
but you don't need these to create adverb Np .)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm