(}. - }:)@]^:[ +/\^:_1 is another way to do finite difference, with a different value for the starting value.
Henry Rich > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Tracy Harms > Sent: Wednesday, December 12, 2007 5:13 PM > To: [email protected] > Subject: [Jprogramming] forward differences > > Awhile back Rob Hodgkinson brought my attention to the > forward difference function. > > ] a=:(i.10)^3 > 0 1 8 27 64 125 216 343 512 729 > diff=: }. - }: > diff a > 1 7 19 37 61 91 127 169 217 > diff^:3 a > 6 6 6 6 6 6 6 > > I want to write a verb that uses the left parameter to > identify the order of forward difference, and the > right for the data. > > The problem I encounter seems to turn on my need to > process a monadic verb within a dyadic context. Here > are some failed incremental efforts: > > diff1=: }. - }:^:1 > diff1 a > 1 7 19 37 61 91 127 169 217 > NB. Success to that small degree. But: > diffx=: }. - }:^:[ > 1 diffx a > |domain error: diffx > | 1 diffx a > NB. Explicit definition also fails: > diffxe=: 3 : '}. - }:^:x y' > 1 diffxe a > |domain error: diffxe > | 1 diffxe a > > How do I keep the left parameter from forcing a dyadic > interpretation of (}. - }:)? Or, is that not the > problem? > > > -- > Tracy B. Harms > > The advantages of executability and universality > found in programming languages can be effectively > combined, in a single coherent language, with the > advantages offered by mathematical notation. > Kenneth E. Iverson > > > > ______________________________________________________________ > ______________________ > Be a better friend, newshound, and > know-it-all with Yahoo! Mobile. Try it now. > http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ > > ---------------------------------------------------------------------- > For information about J forums see > http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
