Note the two different definitions.

http://en.wikipedia.org/wiki/Horner's_method

   f=: 13 :'+`*/ }:,x,.y'
  
   g=:(#.|.)~

  (|. 1 4 _72 _214 127 1602 _5040)  p. 3
_9000
 
 (|. 1 4 _72 _214 127 1602 _5040)  f 3
_9000
   
   
 (|. 1 4 _72 _214 127 1602 _5040 ) g 3
_9000

Linda

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Elton Wang
Sent: Tuesday, May 14, 2013 9:54 AM
To: [email protected]
Subject: Re: [Jprogramming] Does #. Use Horner rule inside

Raul, The task is on Horner rule, which does not mean polynomial evaluation
in general. 
Anyway, I added a direct solution to the wiki as horner =: 4 :  '  (+
*&y)/x'. 

On May 14, 2013, at 7:54 AM, Elton Wang <[email protected]> wrote:

> In Rosetta code Horner code item, it uses (#.|.)~ as a solution. Is this
right? I thought this is plain polynominal sum rather than horner rule,
since for x#.y, the product scan of x is calculated first?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

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

Reply via email to