You get bigger round-off errors when computing the difference between 
logarithms than when computing the logarithm of the ratio. That's why a 
logarithmic mean of almost equal numbers turned out very badly.

   (-/@:^. ,. ^.@:%/)1e13+?2 6$0 
_3.55271e_15 _3.10862e_15
 1.42109e_14  1.53211e_14
 3.55271e_14   3.4861e_14
_7.10543e_15 _6.10623e_15
_6.39488e_14 _6.27276e_14
 3.55271e_15  3.33067e_15



Den 10:36 tirsdag den 22. april 2014 skrev Linda Alvord 
<lindaalv...@verizon.net>:
 
You're right! (lousy proofreading.) I'm getting better at reading all your
>"slight of hand".
>
>Linda
>
>-----Original Message-----
>From: programming-boun...@forums.jsoftware.com
>[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Bo Jacoby
>Sent: Tuesday, April 22, 2014 2:47 AM
>To: programm...@jsoftware.com
>Subject: Re: [Jprogramming] Logarithmic Mean
>
>Of course you ment to write that a
>negative divided by a negative is always a positive. 
>
>Den 21:55 mandag den 21. april 2014 skrev Linda Alvord
><lindaalv...@verizon.net>:
>
>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
>>
>>
>----------------------------------------------------------------------
>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