This might be what you are looking for?
   atan2trivial=: _3 o. %~
   atan2=: 0 { [: +. [: r.^:_1 j.

For the principal domain, atan2trivial matches atan2
   1 (atan2trivial -: atan2) 2
1

However, atan2 can distinguish direction when x=0
   0 atan2 1
1.5708
   0 atan2 _1
_1.5708

I'd like more test cases, though. I've not been doing much trig recently,
and it's possible I made a mistake.

Maybe someone who has been working with this kind of math can judge from
what viewmat displays?

   require 'viewmat'
   viewmat atan2"0/~ i:100

Thanks,

-- 
Raul




On Tue, Mar 11, 2014 at 7:05 PM, EelVex <[email protected]> wrote:

> Is there an atan2 anywhere in some library?
>
> If not maybe we could add it?
>
> A simple start could be:
> atan2 =: +:@(_3&o.)@([ %~ ] -~ +/&.:*:)
> ----------------------------------------------------------------------
> 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