I think Bo's idea is to produce a simplified data set with tally x that
matches the first x moments of the input data set y.

The following verb (simple) is a tacit version of simplify,

   ys=. [ * }.@:(% {.)@:(+/)@:(] ^/ i.@:>:@:[)
   update=. ] ,~ -/@:(] * [ {.~ #@:]) % #@:]

   simple=. -@:|.@:>@:{:@:p.@:(ys update ^: (#@:[) 1:)f.

   1 2 3 <@:simple("0 _) 1 2 3 4 5 6 7
┌─┬───┬─────────────────┐
│4│2 6│1.55051 4 6.44949│
└─┴───┴─────────────────┘

   1 2 3  (simple -: simplify)("0 _) 1 2 3 4 5 6 7
1 1 1

Things become quite interesting for some inputs,

   11 (simple -: simplify) i.111
1

   11 simple i.111
3.45838 18.7042j2.61065 18.7042j_2.61065 40.2983j5.6256 40.2983j_5.6256 55
69.7017j5.6256 69.7017j_5.6256 91.2958j2.61065 91.2958j_2.61065 106.542

As expected,

   (simple i.) 7
0 1 2 3 4 5 6

However, do not try (simple i.) 111


On Thu, Jun 25, 2015 at 10:14 AM, David Lambert <[email protected]>
wrote:

> Is simplify supposed to report the i.x moments of the data?  Would be
> useful.
> When I removed the question marks from simplify to make valid j
>    1 simplify DATA NB. does report the mean
> Otherwise I haven't made sense of the results for the verb I created.
>
>    datatype N
> integer
>
>    3 simplify N
> _951.236j1533.8 _951.236j_1533.8 2658.39
>
>  Date: Thu, 25 Jun 2015 08:39:51 +0000 (UTC)
>> From: "'Bo Jacoby' via Programming"<[email protected]>
>> To: Programming Forum<[email protected]>
>> Subject: [Jprogramming] simplify
>> Message-ID:
>>         <[email protected]>
>> Content-Type: text/plain; charset=UTF-8
>>
>> NB.?If you have got a bunch of numbers? ? ? ]n=.?20#10035 32 66 37 94 56
>> 44 30 25 70 27 68 49 92 96 79 74 99 72 22NB. and you want to simplify, then
>> take the mean value
>>
>
>  <unreadable cut>
>>
>
>  )NB.?If you can simplify the programming, the please let me know.
>> ThanksBo
>>
>
> ----------------------------------------------------------------------
> 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