Newsgroups: comp.lang.apl
Path: watmath!watserv2.uwaterloo.ca!torn!spool.mu.edu!darwin.sura.net!wupost!CSM560.smsu.edu!umn.edu!csus.edu!sfsuvax1.sfsu.edu!emclean
From: emclean@sfsuvax1.sfsu.edu (Emmett McLean)
Subject: Brain Teaser: A "Horners" verb for polynomials
Message-ID: <1993Apr3.043104.25071@csus.edu>
Sender: news@csus.edu
Organization: San Francisco State University
Date: Sat, 3 Apr 1993 04:31:04 GMT
Lines: 29

NB.  I am curious whether it is possible to write a "Horners" gerund. 
NB.  Something like: 

  c =. 2 2 $ 1
 
  (+//.@])`((*/)/"1)/ c
1 2 1

NB.  Which works ok if the rank of ] is 2. (And then why use a gerund?)

NB.  Here is a recursive verb which does what I'd like the gerund to do :
    polyProd =. +//.@({. */ $:@}.)`(,@])@.(1&=@#)"2 
NB.  So:
  ] polynomials =. (1: ,."0 1 -) 3 4 6
1 _3
1 _4
1 _6
   polyProd polynomials 
1 _13 54 _72

NB.    That is, the coefficents of x^3 ... x^0 in the expansion of
NB.    of (x-3)(x-4)(x-6) are 1 _13 54 and _72.
NB. 
NB.    But a gerund implemenatation might be faster. And
NB.    would be a good example for further study. 
NB. 
NB.    Thanks,
NB. 
NB.    Emmett
