MY OOPS

this is correct as (1j0 etc) -1j1  is shown correctly
I intended 1j0......0j1 , (1j1-1j1)

Don Kelly

On 8/24/2016 3:50 PM, dhkelly wrote:
But, as an electrical engineer - a phase angle for a zero length vector is rather useless Th

1 j1-1j1 =0 is sufficient. This tells all. The result is a 0 length vector-i.e. a point and as such, its direction is meaningless.
Your idea of a complex format is good but there appears to be a bug

format_complex &> 1j0 0j1 2 1j1-1j1

0j_1

_1j0

1j_1

0j0

as does this
format_complex 1j1 0j1 1j0 2

Don Kelly
On 8/19/2016 7:29 AM, David Lambert wrote:
Ken developed APL to describe mathematics. Zero means zero. Why would a mathematician want more than a 0 ?

An electrical engineer might want to know the phase explicitly. Having argued both ways, there's more space in format x argument or system parameters to increase available format options.

http://www.jsoftware.com/help/dictionary/d602.htm



   +. 3  NB. Real/Imaginary returns a vector
3 0

   format_complex =: ' '-.~(,'j'&,)/@:(":&>)@+.

   format_complex&> 1j1-1j1 2ad45
0j0
_0.414214j_0.414214


Date: Thu, 18 Aug 2016 23:44:40 -0500
From: Skip Cave<[email protected]>
To:"[email protected]" <[email protected]>
Subject: Re: [Jprogramming] Gustafson's Unums Revisited
Message-ID:
<CAJ8Lg_c2QMsSRxqC2ZnYJZAX7+sBMYBRig_=ek7dughy5ky...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Raul M. & Roger H. have both provided useful verbs that would allow one to
enter complex numbers with a zero imaginary part, thus maintaining a
complex data type in memory. Thanks! As usual, Roger's solution is quite
elegant.

Unfortunately, that's only half the problem. The other half of the issue is
how to displaying a complex number such as (1j0) with a zero imaginary
part, instead of just the real part. Even if the complex number is stored in memory, J throws the zero away on output. I haven't had much luck coding a zero-imaginary-part-displaying verb, but then I am far from a competent J
programmer.

If we did have a display verb that could always show the
zero-imaginary-part of complex numbers in storage, then we would have to use that verb every time we displayed output that might be complex, if we
wanted to see any zero imaginary part.

Raul said: "However, when J displays the number, it routinely removes
irrelevant information."

Relevancy is in the eyes of the beholder. It turns out that J's complex
numbers are useful for other things besides complex arithmetic: eg.
intervals. Also, I know I've seen complex numbers used for other
interesting J applications somewhere, where complex number pairs were used in a novel way, but I can't remember where. Having a native datatype that compactly supports number pairs turns out to be pretty handy for lots of
applications besides complex arithmetic. Of course, boxed pairs could
likely be used in these applications instead, but this would likely add the requirement for various custom manipulation verbs. Common operations with
complex numbers are native in J.

In any case, these other applications that use J's complex invariably need to always maintain both parts of the complex number. Hiding imaginary zeros
in these applications causes lots of exception-handling.

It seems it would be more consistent to simply have the J interpreter not
throw away zero imaginary parts when entering*or*  displaying complex
numbers. J doesn't throw away any other kind of imaginary parts, just zeros.

I have always liked J for it's extreme consistency and minimized rule sets. Hiding zero complex parts seems to me to be an arbitrary rule with minimal benefit. Aside from a small increase in storage, what would be the downside of eliminating the "zero discard" feature in J? Complex number arithmetic
would be unaffected.

Skip

Skip Cave

----------------------------------------------------------------------
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