A mean is a comparison with rules about two numbers.  However, I get a
different answer than Bo.  I have no idea what the answer should be.
Interesting problem.

   lm=: 13 : 'y*l x%y'  
   
   lm~ >:i.10
0 0 0 0 0 0 0 0 0 0
   
   5 lm 20
10.8202
   
   lm2=: 13 :'(|x-y)%^.|x-y'
   
   lm2~ >:i.10
0 0 0 0 0 0 0 0 0 0
   
   5 lm2 20
5.53904
   
   lm
] * [: l %
   
   lm2
([: | -) % [: ^. [: | -
   
Linda   

-----Original Message-----
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Bo Jacoby
Sent: Monday, April 21, 2014 12:48 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Logarithmic Mean

Try this:

   l=. 13 : '(<:y)%^.y'
   lm=. 13 : 'y*l x%y' f. NB. logarithmic mean
   lm
] * [: (<: % ^.) %
   3 lm 3.000002
3
   3 lm 3.00002
3.00001

Thanks. Bo.


Den 2:04 mandag den 21. april 2014 skrev Raul Miller
<rauldmil...@gmail.com>:
 
On Sun, Apr 20, 2014 at 7:08 PM, Henry Rich <henryhr...@nc.rr.com> wrote:
>> More exact equality isn't enough - as you can see from the example, it
>> calculates a mean of 2.7 when 3 is the right answer.  The problem there
is
>> roundoff error I expect.
>
>I doubt the numbers I am working with would have even 10 digits of
>accuracy, so I'm actually not too worried.
>
>Thanks,
>
>
>-- 
>Raul
>----------------------------------------------------------------------
>For information about J forums see http://www.jsoftware.com/forums.htm
>
>
>
----------------------------------------------------------------------
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