On Thu, Aug 27, 2009 at 4:59 PM, Kip Murray<[email protected]> wrote: > 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? > ----------------------------------------------------------------------
I think you are asking for this: Np=:adverb define 'coef valu'=:m [:+/ coef * (>:/~i.#valu) */@:^~"1 (1:,-&(}:valu)) ) au=: 0 1 4 1,:0 1 3 6 au Np"0 i. 5 0 1 8 27 64 That said, I think I would prefer to transform the argument so I could use p. in my derived verb. -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
