I know you guys are discussing arithmetic, but I always preferred algebra.
Specifically, the distillation of an idea through simplification,
factorization, and reduction of common elements.  

           13 : '(i: 9 o. y) j./ i: 11 o. y'
        ([: i: 9 o. ]) j./ [: i: 11 o. ]

Let's see what we can do here.   

We have ([: i: 9 o. ]) j./ ([: i: 11 o. ]), which presents an interesting
symmetry.  Specifically, it looks like ([: f foo) g ([: f bar) which could
be phrased as f@:foo g f@:bar .  This latter form makes it clear that f is
the last operation of both the left and the right tines: it is reflected
about the middle.  Well, we can replace both those reflections with a single
f and a mirror.  The mirror is &, as in foo g&f bar .*

Ok, so now we've got (9 o. ]) g&f (11 o. ]) , which still presents an
interesting, possibly reducible, symmetry. Our first reduction took
advantage of the fact that the reflection was perfect: i: was the final
operation on both sides of the middle.  But here, the final operations of
the left and right tines are different: the left is 9 o. y and the right is
11 o. y (which mean different things). 

And yet they're suggestively similar.  They're both of the form m o. ] .
Maybe we can make some headway.  The first thing we think is "Aha!  o. is
scalar. It's rank zero, so (9 o. y),:(11 o. y) is the same as 9 11 o. y !"
So perhaps our first instinct is to try  9 11 (g&f)&o. y .  But applying the
same rules 9 11 (g&f)&o. y becomes (o. 9 11) g&f (o. y) which is not what we
want.  We somehow want to insert g&f between the two results of 9 11 o. y ,
like it was originally.

Are we stumped?  Not hardly.  We already have the answer: we're using j./ to
make at "j. table" by inserting j.s between all the pairs of the inputs
(like */ would be a multiplication table).  So we know / can be used to
insert verbs between elements of the input.  In this case, we want to insert
the verb is g&f and between the results of 9 11 o. y (of course, in the j.
example we're using dyad f/ and here we're using the monad, the spirit is
the same, by design).  So we can say g&f/ 9 11 o. y .  To make that a
reusable verb, which is independent of y, we simply glue the two pieces
together with @ as in g&f/@(9 11 o. ]) .  Or we could use the other meaning
of & to glue the 9 11 to o. directly, as in g&f/@(9 11&o.) .

Substituting back for g and f, we have j./&i:/@(9 11&o.) .  Pretty good!  Is
that as far as we can go?  Well, I don't see any common factors left to
reduce.  So based only on form (syntax), maybe we've simplified it as much
as we can.  And yet, at another level, we still have redundancy.  We're
asking  o.  to do two things.  Now, o. is special because its left argument
can completely change its meaning, and since it's scalar and we're giving it
two left arguments (9 and 11), we're in effect asking two separate
questions.  But as Kip pointed out, all the questions are fundamentally
related.  Let's see if we can take advantage of that relationship.

We start by looking at the two questions we're asking of o. . From the
vocabulary, (9 o. y) is the "real part of y", and (11 o. y) is the
corresponding "imaginary part of y". That is, y has the form A + Bi, and 9
o. y produces A and 11 o. y produces B, so 9 11 o. y produces A,B.  Clearly
these two questions are related, and pretty fundamental. We might suspect J
provides other ways to answer them.  So we look through the vocabulary
again, and come across this sentence: "+.y yields a two-element list of the
real and imaginary parts of its argument." .  Perfect.  By looking beyond
the form of j./&i:/@(9 11&o.) and thinking about the meanings of the words,
we found another simplification:  9 11&o.  is the same as  +.  .  

Applying that final substitution, we get j./&i:/@+. .  Nice!  No parens,
even.

Now let's compare it with the original ([: i: 9 o. ]) j./ ([: i: 11 o. ])  .
Sure, the reduced version is shorter and less redundant: that was our goal.
So let's try a different test.  Let's read the two phrases aloud. In
English.  The first starts at the left and ends at the right: "make the
complex-number (j.) table (/) from (&) the counts (i:) of (@) the real and
imaginary parts (+.) of the input (y)".  The second "starts" in the middle.
How do you read that left-to-right? Try it, and don't cheat by skipping [: .

Now, while I do enjoy the sport of simplification, I certainly don't believe
a J expression must have some pithy, bijective, sequential English sentence
equivalent to be good, or beautiful. In fact, the purpose of a good notation
is to allow us to transcend the limitations of English, and think in new
ways (hence math notation, and the ideas it provokes).  But anyway, I
personally would have no problem with phrasing ([: i: 9&o.) j./ ([: i:
11&o.) as "the complex (j.) table (/) whose rows are formed from counting up
(i:) the real part (9&o.) and columns are formed by the counting up (i:) the
imaginary part (11&o.) of the input".  It's a mouthful, at least in writing,
but it's clear.  

But one of Linda's stated aims is to teach math to children by letting them
read J sentences left-to-right.  And here is an example where conjunctions
and composition advance that cause, in contradiction to the worry that they
hinder it. 

[Which also explains why I wrote this post in such a longwinded, expository
style.  The observation that we could replace ic with j./&i:/@+. occurred to
me immediately, but this kind of guided analysis could help explain it to
someone who isn't as familiar with the language.]

-Dan

*  Kirk Iverson taught me to voice & as "but first", as in:

        *&+:      <=>  "multiply, BUT FIRST, halve" 
        -:&(/:~)  <=>  "compare, BUT FIRST, sort" 
        +&#       <=>  "sum, BUT FIRST, tally" 

etc.


PS:  It's always good to test our theories, so:

   ic   =. [: , ([: i: 9&o.) j./ ([: i: 11&o.)
   ic2  =. [: , j./&i:/@+.
   
   ic  1     NB. Kip example #1
_1 0 1
   ic2 1
_1 0 1
   
   ic  2     NB. Kip example #2
_2 _1 0 1 2
   ic2 2
_2 _1 0 1 2
   
   ic  1j2   NB. Kip example #3
_1j_2 _1j_1 _1 _1j1 _1j2 0j_2 0j_1 0 0j1 0j2 1j_2 1j_1 1 1j1 1j2
   ic2 1j2
_1j_2 _1j_1 _1 _1j1 _1j2 0j_2 0j_1 0 0j1 0j2 1j_2 1j_1 1 1j1 1j2
   
   ic  0j2   NB. Kip example #4
0j_2 0j_1 0 0j1 0j2
   ic2 0j2
0j_2 0j_1 0 0j1 0j2
   
   (ic2 -: ic)&> 1 2 1j2 0j2
1 1 1 1

NB.  But...

   (ic2 -: ic) 1 2 1j2 0j2
0

NB. When we move beyond the original scope of a single, scalar input
NB. the answers differ.  What gives?  Left as an exercise for the reader.



-----Original Message-----
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of km
Sent: Saturday, January 19, 2013 6:21 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] [Jprogrammingou Hermitian from triangular

Linda, now please consider

    ic  NB. interval from complex
 [: , ([: i: 9&o.) j./ [: i: 11&o.
    ic 0j2
 0j_2 0j_1 0 0j1 0j2

Kip

Sent from my iPad


On Jan 19, 2013, at 4:53 AM, "Linda Alvord" <lindaalv...@verizon.net> wrote:

>   C=: 0j_2 0j_1 0 0j1 0j2
>   f
> -: /:~
>   f C
> 1
> 
> 
> -----Original Message-----
> From: programming-boun...@forums.jsoftware.com
> [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of km
> Sent: Friday, January 18, 2013 10:47 PM
> To: programm...@jsoftware.com
> Subject: Re: [Jprogramming] [Jprogrammingou Hermitian from triangular
> 
> For what it's worth
> 
>    ic 1j2
> _1j_2 _1j_1 _1 _1j1 _1j2 0j_2 0j_1 0 0j1 0j2 1j_2 1j_1 1 1j1 1j2
> 
>    (-: /:~) ic 1j2
> 1
> 
> On ordering the complex numbers, see the penultimate sentence of the 
> vocabulary entry for Grade /:
> 
> http://www.jsoftware.com/docs/help701/dictionary/d422.htm
> 
> Kip
> 
> Sent from my iPad
> 
> 
> On Jan 18, 2013, at 8:28 PM, "Linda Alvord" <lindaalv...@verizon.net>
wrote:
> 
>> At least these are sensible subsets of complex numbers. In their 
>> entirety, complex numbers have been considered unorderable (at least 
>> when I went to school).
>> 
>> Instead of:
>>  ic 1j2
>> _1j_2 _1j_1 _1 _1j1 _1j2 0j_2 0j_1 0 0j1 0j2 1j_2 1j_1 1 1j1 1j2
>> 
>> how about this:
>> 
>>  ic 1j2
>> 1j_2 1j_1 1 1j1 1j2
>> 
>> It seems to match:
>> 
>>  ic 0j2
>> 0j_2 0j_1 0 0j1 0j2
>> 
>> I haven't considered how you got your subsets or how you would get my 
>> alternative.
>> 
>> Linda
>> 
>> -----Original Message-----From: 
>> programming-boun...@forums.jsoftware.com
>> [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of km
>> Sent: Friday, January 18, 2013 11:14 AM
>> To: programm...@jsoftware.com
>> Subject: Re: [Jprogramming] Hermitian from triangular
>> 
>> Linda, would you buy
>> 
>>    ic =: 13 : ',(i: 9 o. y) j./ i: 11 o. y'
>>   ic 1
>> _1 0 1
>>   ic 2
>> _2 _1 0 1 2
>>   ic 1j2
>> _1j_2 _1j_1 _1 _1j1 _1j2 0j_2 0j_1 0 0j1 0j2 1j_2 1j_1 1 1j1 1j2
>> 
>>   ic 0j2
>> 0j_2 0j_1 0 0j1 0j2
>> 
>> Kip
>> 
>> Sent from my iPad
>> 
>> 
>> On Jan 18, 2013, at 4:33 AM, "Linda Alvord" <lindaalv...@verizon.net>
> wrote:
>> 
>>> Kip, I just got back to a different and interesting sidetrack on 
>>> this long thread.  What a simple way to write a proof in J.
>>> 
>>>  _1 = ^ 0j1 * o. 1
>>> 1
>>> 
>>> (0j1 * o.1) = ^. _1
>>> 1
>>> 
>>> 
>>> Therefore:  Negative numbers can have logarithms to the base e
>>> 
>>> Can they also have common logs?
>>> 
>>> Also, It makes you wonder if there isn't some sequence out there 
>>> somewhere where there is an ordered sequence of complex numbers:
>>> 
>>>  i:2
>>> _2 _1 0 1 2
>>> 
>>> i:0j2
>>> 
>>> Happy wandering and pondering.
>>> 
>>> Linda
>>> 
>>> 
>>> -----Original Message-----
>>> From: programming-boun...@forums.jsoftware.com
>>> [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of km
>>> Sent: Thursday, January 17, 2013 9:31 AM
>>> To: programm...@jsoftware.com
>>> Subject: Re: [Jprogramming] Hermitian from triangular
>>> 
>>> Linda, about logarithms of negative numbers
>>> 
>>> First of all, you know the number e =: ^ 1 and you know ^ y is e^y .  
>>> You may not know that  ^ x j. y  by definition is  (^ x) * (cos + 
>>> 0j1
>>> * sin) y where cos =:  2&o. and sin =: 1&o.  .  I first learned this 
>>> in a college math class called Complex Analysis.  A good reference is E.
>> B. Saff and A.
>>> D. Snider, Fundamentals of Complex Analysis, Pearson Education, Inc.
> 2003.
>>> 
>>> Anyway, a famous identity in higher math is
>>> 
>>>  _1 = ^ 0j1 * o. 1
>>> 1
>>> 
>>> which should tell you that
>>> 
>>>  (0j1 * o.1) = ^. _1
>>> 1
>>> 
>>> i.e., negative numbers can have logarithms to the base e .  For more 
>>> on this, please see Saff and Snider's Chapter 3.
>>> 
>>> Kip Murray
>>> 
>>> Sent from my iPad
>>> 
>>> 
>>> On Jan 17, 2013, at 4:22 AM, "Linda Alvord" 
>>> <lindaalv...@verizon.net>
>> wrote:
>>> 
>>>> Isn't the log of negative numbers indefined?
>>>> 
>>>> This is a problem:
>>>> 
>>>> %1&o.+0
>>>> _
>>>> %1&o.-0
>>>> _
>>>> 
>>>> This is nice!
>>>> 
>>>> %1&o.%_
>>>> _
>>>> %1&o.%__
>>>> __
>>>> 
>>>> 
>>>> The csc is very small for negative numbers close to zero and very 
>>>> large for very small positive numbers.
>>>> 
>>>> Linda
>>>> 
>>>> -----Original Message-----
>>>> From: programming-boun...@forums.jsoftware.com
>>>> [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Bo 
>>>> Jacoby
>>>> Sennt: Thursday, January 17, 2013 3:37 AM
>>>> To: programm...@jsoftware.com
>>>> Subject: Re: [Jprogramming] Hermitian from triangular
>>>> 
>>>> Henry, How is negative zero different from positive zero when 
>>>> taking the log?
>>>> ^.%__ NB. log -0
>>>> __
>>>> ^.%_  NB. log +0
>>>> __
>>>> 
>>>> 
>>>> - Bo
>>>> 
>>>> 
>>>>> ________________________________
>>>>> Fra: Henry Rich <henryhr...@nc.rr.com>
>>>>> Til: programm...@jsoftware.com
>>>>> Sendt: 0:38 torsdag den 17. januar 2013
>>>>> Emne: Re: [Jprogramming] Hermitian from triangular
>>>>> 
>>>>> Negative zero makes sense as a last vestige of gradual underflow; 
>>>>> and
>>>> anyway, it's well-behaved: it looks like 0 except when you take the 
>>>> log, reciprocal, or square root.  In any normal computation, it 
>>>> goes away. In contrast, NaN messes up anything it touches.
>>>>> 
>>>>> I think we've had negative 0 in J forever.  If NaN is a data 
>>>>> virus,
>>>>> -0 is a
>>>> virus that has been inserted into our DNA.
>>>>> 
>>>>> Henry Rich
>>>>> 
>>>>> On 1/16/2013 4:45 PM, Raul Miller wrote:
>>>>>> On Wed, Jan 16, 2013 at 4:35 PM, Henry Rich 
>>>>>> <henryhr...@nc.rr.com>
>>> wrote:
>>>>>>> Negative zero isn't a bug, it's a feature that numerical types, 
>>>>>>> especially William Kahan, wanted to get into IEEE-754 to help 
>>>>>>> out some things.  I'm not expert enough to explain.
>>>>>> 
>>>>>> Something similar could be said about NaN.
>>>>> ------------------------------------------------------------------
>>>>> -
>>>>> -
>>>>> -
>>>>> - 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
> 
> ----------------------------------------------------------------------
> 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