[Jprogramming] A complex question?
km
km at math.uh.edu
Tue Dec 17 13:20:46 UTC 2013
NB. Identities for ^.@* and ^.@% and ^.@^ with complex arguments
prodid =: 1 = [: ^ ^.@* - +&^.
quotid =: 1 = [: ^ ^.@% - -&^.
pwrid =: 1 = [: ^ ^.@^ - (* ^.)~
NB. Remark ^ is periodic with period 0j2p1
periodtest =: 2 : '(v"0 y) = v"0 y+m'
0j2p1 periodtest ^ 2 0j3 4j_5
1 1 1
]xx =: 2 3j_4 5j6
2 3j_4 5j6
]yy =: _3 _4j_5 6j7
_3 _4j_5 6j7
xx prodid"0 yy
1 1 1
xx quotid"0 yy
1 1 1
xx pwrid"0 yy
1 1 1
NB. Reciprocals are covered by 1 quotid"0 yy and 0 = ^. 1
--Kip Murray
Sent from my iPad
> On Dec 17, 2013, at 2:09 AM, "Linda Alvord" <lindaalvord at verizon.net> 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-bounces at forums.jsoftware.com
> [mailto:programming-bounces at forums.jsoftware.com] On Behalf Of km
> Sent: Monday, December 16, 2013 10:54 PM
> To: programming at 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 at 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-bounces at forums.jsoftware.com
>> [mailto:programming-bounces at forums.jsoftware.com] On Behalf Of km
>> Sent: Monday, December 16, 2013 7:49 PM
>> To: programming at 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 at 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
More information about the Programming
mailing list