Hi Roger, Thanks.
I'll keep this in my code library. Much appreciated. r/Alex -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Roger Hui Sent: Thursday, January 28, 2010 10:45 AM To: Programming forum Subject: Re: [Jprogramming] Running Subtraction x=: 35.5 ] y=: 2*5+i.5 10 12 14 16 18 +/\ y NB. running sums 10 22 36 52 70 x <. +/\ y NB. running sums, up to a maximum of x 10 22 35.5 35.5 35.5 2 -~/\ 0,x <. +/\ y NB. first differences (deltas) of the above 10 12 13.5 0 0 Another way to look at the first differences, is that they are the contribution of each element of y toward the running sum, up to a maximum of x . ----- Original Message ----- From: Alex Rufon <[email protected]> Date: Wednesday, January 27, 2010 18:37 Subject: Re: [Jprogramming] Running Subtraction To: Programming forum <[email protected]> > I have a question. > > In Rogers code: > 2-~/\0,x<.+/\y > > I understood that 'x<.+/\y' gives the floor for each value. > What I don't get is '2-~/\0,'? > > I would appreciate further clarification. Thanks. > > -----Original Message----- > From: [email protected] [mailto:programming- > [email protected]] On Behalf Of Roger Hui > Sent: Thursday, January 28, 2010 2:41 AM > To: Programming forum > Subject: Re: [Jprogramming] Running Subtraction > > f=: 4 : 'c-~y*0=c=. 2-~/\0,x<.+/\y' > > a=: 2*5+i.5 > 35.5 f a > _10 _12 _13.5 16 18 > 36 f a > _10 _12 _14 16 18 > > It is possible that the application would be > better served with the separate results > 10 12 13.5 0 0 (used) and 0 0 0.5 16 18 (remainder) > for 35.5 f a . > > > > ----- Original Message ----- > From: Roger Hui <[email protected]> > Date: Wednesday, January 27, 2010 8:59 > Subject: Re: [Jprogramming] Running Subtraction > To: Programming forum <[email protected]> > > > a*_1^0>:b-+/\a gets close, with a fix-up required > > for the element on the boundary. > > > > The result is the negation of the usage in each bin, > > but unused bins retain their original values. > > > > > > > > ----- Original Message ----- > > From: Raul Miller <[email protected]> > > Date: Wednesday, January 27, 2010 8:45 > > Subject: Re: [Jprogramming] Running Subtraction > > To: Programming forum <[email protected]> > > > > > On Wed, Jan 27, 2010 at 10:54 AM, Alex Rufon > > <alex_ru...@ist- > > > systems.com> wrote: > > > > [a=. 2 * 5 + i. 5 > > > > 10 12 14 16 18 > > > > [b=. 35.5 > > > > 35.5 > > > ... > > > > I want to subtract a from b progressively until b is 0 so > > from > > > the data above I'll get the following results: > > > > _10 _12 _13.5 16 18 > > > > > > This description does not make sense to me. > > > > > > Here are my guesses for where these numbers came from: > > > > > > _10 -: -0{a > > > _12 -: -1{a > > > _13.5 -: b - +/0 1{a > > > 16 -: 3{a > > > 18 -: 4{a > > > > > > But I can not figure out how my guesses relate to > > > your description. > > > > > > If I understood your description properly, you might > > > be interested in something like: > > > b-+/\.&.|. a > > > 25.5 13.5 _0.5 _16.5 _34.5 > > > or > > > 0 >. b-+/\.&.|. a > > > 25.5 13.5 0 0 0 > > > > > > But I am not at all confident that this is what you > > > are looking for. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
