What is the purpose of this exercise?
Finally, Kim broke it down to what appears to be the unstated initial problem and expressed it succinctly. it appears to be that what was wanted is the negative of the magnitude of a complex number. (or x,y values). That is -^.| xjy or ^.% |xjy (- is better).

Using j./ is great but what if you want several pairs such as (1,1),(2,1), (1, 2),(3,4)?There is a problems. This works with the x and y values in columns.
x=:4 1$1 2 1 3
y=: 4 1$1 1 2 4

  -^.| x j. y
_0.346574
_0.804719
_0.804719
 _1.60944

However why not express x and y values in the form xjy

1j1 2j1 2j2 3j4   which may be more easily entered.


  -^.| 1j1 2j1 1j2 3j4
_0.346574 _0.804719 _0.804719 _1.60944


 ^ -^.| 1j1 2j1 1j2 3j4
0.707107 0.447214 0.447214 0.2

   %| 1j1 2j1 1j2 3j4
0.707107 0.447214 0.447214 0.2   checks

Don Kelly



On 10/12/2013 10:40 AM, km wrote:
    - ^. | j./ 1 1
_0.346574

--Kip Murray

Sent from my iPad

On Dec 10, 2013, at 9:03 AM, Marshall Lochbaum <[email protected]> wrote:

-@^.@|@j./"1 does the trick.

You can also use (+/&.:*:) in place of |@j./ , leaving you with
-@^.@(+/&.:*:)"1
.

Marshall

On Tue, Dec 10, 2013 at 09:55:22AM -0500, Raul Miller wrote:
Is there a better way of doing this?

   {: +. r.inv j./1 1
_0.346574

Assume 1 1 can be replaced with any reasonable coordinate pair.

I'm looking for either conciseness or clarity (ideally both, but
mostly I want some good options).

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

Reply via email to