[Jprogramming] A plane rotation
Raul Miller
rauldmiller at gmail.com
Tue Feb 16 23:09:24 UTC 2016
Ah, yes, as Michal's implementation shows, there is a more concise approach.
Mine becomes:
rot=: (% |)~&.(+.inv)
Thanks,
--
Raul
On Tue, Feb 16, 2016 at 6:07 PM, Raul Miller <rauldmiller at gmail.com> wrote:
> I guess I'd do that like this:
>
> rot=: (* (% |))~&.(+.inv)
>
> There might be more concise ways of doing this though.
>
> --
> Raul
>
> On Tue, Feb 16, 2016 at 4:18 PM, Kip Murray <thekipmurray at gmail.com> wrote:
>> Fairly easy: write a verb that rotates a point in the plane by the angle of
>> a given complex number. For example
>>
>> 1j1 rot 1 1 NB. Rotate 1 1 counterclockwise 45 degrees
>> 0 1.414213562
>>
>> Background information: when you multiply two complex numbers the
>> magnitudes are multiplied and the angles are added.
>>
>> --Kip Murray
>>
>>
>>
>> --
>> Sent from Gmail Mobile
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list