That was a good math lesson!  I couldn't believe I hadn't noticed that a
negative divided by a negative is always a negative. You used some cleveer
ways of simplifying the expression. I liked how you Went outside the
parentheses or were "thinking outside the box"

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 7:16 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] Logarithmic Mean

Hi Linda. Translating from your version to mine:

   5(13 :'(|x-y)%|(^.x)-^.y')20 NB. Linda's lm3
10.8202
   5(13 :'(x-y)%(^.x)-^.y')20 NB. omitting '|' 
10.8202
   5*1(13 :'(x-y)%(^.x)-^.y')20%5 NB. homogeneity
10.8202
   5*(13 :'(1-y)%(^.1)-^.y')20%5 NB. fix x=1
10.8202
   5*(13 :'(<:y)%^.y')20%5 NB. (x%y) = (-x)%-y
10.8202
   13 :'(<:y)%^.y' NB. tacit
<: % ^.
   5*(<:%^.)20%5 NB. check
10.8202
   5(13 :'y* (<:%^.) x%y') 20 NB. linearity
10.8202
   13 :'y* (<:%^.) x%y' NB. tacit
] * [: (<: % ^.) %
   5(] * [: (<: % ^.) %)20 NB. check
10.8202



Den 11:17 mandag den 21. april 2014 skrev Linda Alvord
<lindaalv...@verizon.net>:
 
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: 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
>
>
>
----------------------------------------------------------------------
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