I should have gone to the original website a lot sooner.
lm3=: 13 :'(|x-y)%|(^.x)-^.y'
5 lm2 20
10.8202
lm3
([: | -) % [: | ([: ^. [) - [: ^. ]
Now this agrees with Bo's shorter version..
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Bo Jacoby
Sent: Monday, April 21, 2014 12:48 AM
To: [email protected]
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
<[email protected]>:
On Sun, Apr 20, 2014 at 7:08 PM, Henry Rich <[email protected]> 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