Look at

   ^. _2 _0.5
0.693147j3.14159 _0.693147j3.14159

   ^ +/ ^. _2 _0.5  NB. "Practically 1" on my iPad
1j_2.44929e_16

   ^ 0 0j2p1  NB. Second result is "practically 1"
1 1j_2.44929e_16

Because verb  ^  has period  0j2p1  a number can have many complex logarithms.  
Verb  ^.  picks out the one whose imaginary part  imp  satisfies  _1p1 < imp  
and  imp <: 1p1  .  For a straightforward treatment of complex logarithms see 
Section 2.6 beginning page 46 of Polya and Latta's 1974 book Complex Variables.

--Kip

Sent from my iPad

>> On 17/12/2013 12:09 AM, Linda Alvord wrote:
>> Is this a true statement?
>> 
>>    NB. Taking the logarithm of the reciprocal of a
>>    NB. number changes the sign of all parts of the logarithm
>>    NB. the original number.
>>        N=: 4 2 1 0 0.5 0.25
>>        ^. N
>> 1.38629 0.693147 0 __ _0.693147 _1.38629
>>        ]R=: % N
>> 0.25 0.5 1 _ 2 4
>>        ^. R
>> _1.38629 _0.693147 0 _ 0.693147 1.38629
>>        C=:1j1 _1j1 _1j_1 1j_1
>>        ^.C
>> 0.346574j0.785398 0.346574j2.35619 0.346574j_2.35619 0.346574j_0.785398
>>        ]RC=: % C
>> 0.5j_0.5 _0.5j_0.5 _0.5j0.5 0.5j0.5
>>        ^. RC
>> _0.346574j_0.785398 _0.346574j_2.35619 _0.346574j2.35619 _0.346574j0.785398
>>    Linda
>> 
>> From: programming-boun...@forums.jsoftware.com
>> [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of km
>> Sent: Monday, December 16, 2013 10:54 PM
>> To: programm...@jsoftware.com
>> Subject: Re: [Jprogramming] A complex question?
>> 
>> Off topic: I now know that taking the logarithm of the reciprocal of a
>> non-zero real number changes the sign of the real part of the logarithm of
>> the original number:
>> 
>>    csrp NB. change sign of real part
>> (1r2 * -@(+ +) + (- +))"0
>>    csrp 1j2 _3j_4
>> _1j2 3j_4
>>    ]rr =: 1 % 4 2 1 0.5 0.25  NB. non-zero reals
>> 0.25 0.5 1 2 4
>>    (^.@% -: csrp@^.) rr
>> 1
>>    (^.@% -: csrp@^.) -rr
>> 1
>> 
>> --Kip
>> 
>> Sent from my iPad
>> 
>>> On Dec 16, 2013, at 7:02 PM, "Dan Bron" <j...@bron.us> wrote:
>>> 
>>> Not sure.  I suppose instead of
>>> 
>>>    -@^.@(+/&.:*:)
>>> 
>>> we could write:
>>> 
>>>    ^.@%@(+/&.:*:)
>>> 
>>> or even:
>>> 
>>>    ^.@(+/&.:(*: :. (^&_0.5) ) )
>>> 
>>> But I'm not sure what this buys us.
>>> 
>>> -----Original Message-----
>>> From: programming-boun...@forums.jsoftware.com
>>> [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of km
>>> Sent: Monday, December 16, 2013 7:49 PM
>>> To: programm...@jsoftware.com
>>> Subject: Re: [Jprogramming] A complex question?
>>> 
>>> Dan, I haven't been following this thread, but know that minus the
>>> logarithm of a positive number is the logarithm of the reciprocal.  Is
>> that relevant?
>>>   ^. 1r4 1r2 1 2 4
>>> _1.38629 _0.693147 0 0.693147 1.38629
>>> 
>>> 
>>> --Kip
>>> 
>>> Sent from my iPad
>>> 
>>>> On Dec 16, 2013, at 3:42 PM, Dan Bron <j...@bron.us> wrote:
>>>> 
>>>> Raul wrote:
>>>>> Is there a better way of doing this?
>>>>>  {: +. r.inv j./1 1
>>>> Marshall responded:
>>>>> You can also use (+/&.:*:) in place of |@j./ , leaving you with
>>>>> -@^.@(+/&.:*:)"1
>>>> Raul wrote:
>>>>> Experimenting: the - is necessary and the ^. is not necessary.
>>>>> (I do not get a hexagon without the minus, I do get a hexagon
>>>>> without the ^.).
>>>>> Immediately after writing this I realized the - is also unnecessary
>>>>> - changing >./ to <./
>>>> What I love is that through some simple trig and a few experiments,
>>>> we got from {:@+.@(r.^:_1)@(j./) to +/&.:*: .
>>>> 
>>>> I suppose I find this particularly gratifying because I spent some
>>>> time trying to restate Raul's phrase in terms of simple arithmetic
>>>> operations, staying entirely in the real domain, and I eventually
>>>> reproduced Marshall's verb.  Having spent so much time "simplifying",
>>>> when I got the final, irreducible result, I wondered at the need for
>>>> -@^. , and what its physical interpretation was.
>>>> 
>>>> Raul's original verb could be rendered in English as "the length
>>>> component of a polar coordinate (initially specified in Cartesian
>>>> terms)".  Why should that length be expressed as the negative log of
>>>> a distance?  Why not, as Don put it, "the raw distance"?
>>>> 
>>>> I know there are subtle and beautiful connections between the
>>>> trigonometric and exponential functions, and the e hidden in r. is
>>>> one expression of that.  But I'm still not seeing the fundamental
>>>> physical
>>> interpretation.
>>>> In other words, I wasn't surprised with the -@^. disappeared in
>>>> Raul's use case; I might've been more surprised if it'd persisted.
>>>> 
>>>> Anyone want to help me see it? Maybe the best illustration would be a
>>>> concrete use case where the -@^. isn't superfluous - one where where
>>>> it is not only necessary, but inevitable?
>>>> 
>>>> That is, a use case where -@^. has obvious physical interpretation,
>>>> when applied to the distance. Ideally one like Raul's, which
>>>> ultimately didn't involve complex numbers (i.e. a real-valued binary
>>>> [dyadic] operation on real numbers).
>>>> 
>>>> -Dan
>>>> 
>>>> ---------------------------------------------------------------------
>>>> - 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