[Jprogramming] A plane rotation
Don Kelly
dhky at shaw.ca
Tue Feb 23 03:19:56 UTC 2016
rotheta=:[: +. ([: r. [) * [: +.^:_1 ]
1r2p1 rotheta 3 4
_4 3
1r4p1 rotheta 2 2$ 3 4 _1 1
_0.707107 4.94975
_1.41421 0
2 1$ 1r2p1 1r4p1 rotheta 2 2$ 3 4 _1 1
_4 3
_1.41421 0
It would be simpler to enter positions as complex numbers in the first
place.
(r.1r2p1) * 3j4
_4j3
Don Kelly
On 2/16/2016 8:50 PM, Kip Murray wrote:
> I'm retired with time to "fool around". Finding an old rot90 verb that
> used multiplication by a 2 by 2 matrix, I sought a more direct way using
> complex numbers and found one of the solutions that was posted. I also
> learned a lot from the other solutions posted, thanks everyone!
>
> New puzzle: find a complex analysis way to do a rotation given its angle in
> radians, examples:
>
> 1r2p1 rottheta 3 4
> _4 3
>
> 1r4p1 rottheta _1 1
> _1.414213562 0
>
> --Kip
>
> I'm also a former math professor!
>
> On Tuesday, February 16, 2016, David Lambert <b49p23tivg at gmail.com> wrote:
>
>> what's your agenda, are you writing a book? Isn't there a homogeneous
>> coordinate system/transformation lab?
>>
>>> On 02/16/2016 06:16 PM, programming-request at forums.jsoftware.com wrote:
>>>
>>>> Date: Tue, 16 Feb 2016 15:18:43 -0600
>>>> From: Kip Murray<thekipmurray at gmail.com>
>>>> To:"programming at jsoftware.com" <programming at jsoftware.com>
>>>> Subject: [Jprogramming] A plane rotation
>>>> Message-ID:
>>>> <CAOfWorgVyDB1NmJwXkB0WOSYFnLUBXCDZ20sV11ukSFCfay5sA at mail.gmail.com>
>>>> Content-Type: text/plain; charset=UTF-8
>>>>
>>>> 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
>>>>
>>>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
More information about the Programming
mailing list