I like  the atan2 suggested by Tom.

13.03.2014, в 5:17, EelVex <[email protected]> написал(а):

> Isn't
> 
> atan2 =: 12&o.@j./~
> 
> a very good candidate for inclusion in math/misc/trig.ijs ?
> 
> 
> On Wed, Mar 12, 2014 at 4:07 AM, Tom Arneson <[email protected]> wrote:
> 
>> The circle verb o. with 12 as the left argument
>> 
>>   NB. radian to degree
>>   r2d=: 180p_1*[
>> 
>>   atan2=: 12&o.
>> 
>>   [r=. atan2 0j0 1j1 0j1 _1j1 _1j0 _1j_1 0j_1 1j_1 1j0
>> 0 0.785398 1.5708 2.35619 3.14159 _2.35619 _1.5708 _0.785398 0
>> 
>>   r2d r
>> 0 45 90 135 180 _135 _90 _45 0
>> 
>>   360|r2d r
>> 0 45 90 135 180 225 270 315 0
>> 
>> -----Original Message-----
>> From: [email protected]
>> [mailto:[email protected]] On Behalf Of Raul Miller
>> Sent: Tuesday, March 11, 2014 19:00
>> To: Programming forum
>> Subject: Re: [Jprogramming] atan2 ?
>> 
>> 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
>> 
>> ----------------------------------------------------------------------
>> 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