My typo   -----correction 12&0. not 13&o.
I agree with Bill Lam as typically one isn't making a table but finding an angle from a given complex number (or array)
 12&0. @j./~ makes a table

Don

Using  13&o. as Tom suggested:

at=:13&o.
at  j./~i:100

gives the same result with both viewmat and plot as

atan2"0/~ i:100

Don

On 11/03/2014 4:59 PM, Raul Miller wrote:
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,


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to