Here's an implementation of horner's algorithm (with the appropriate
intermediate results, regardless of the implementation of #.)

horner=: +`*/@|.@}.@,@,.

Example use:

   13 horner 2 _3 1
300

In other words, in this example we are computing:
   1+13*_3+13*2
or, with redundant parenthesis included:
   1+(13*(_3+(13*2)))

FYI,

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

Reply via email to